Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
liuyehcf committed Jul 18, 2022
1 parent b6d0671 commit ca42225
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions be/src/exec/vectorized/partition/partition_hash_map.h
Expand Up @@ -93,7 +93,7 @@ struct PartitionHashMapBase {
return;
}
auto partition_num = hash_map.size();
if (partition_num > 512 && total_num_rows / partition_num < 10000) {
if (partition_num > 512 && total_num_rows < 10000 * partition_num) {
is_downgrade = true;
}
}
Expand All @@ -114,17 +114,17 @@ struct PartitionHashMapBase {
visited_keys(chunk->num_rows());
const auto size = chunk->num_rows();
uint32_t i = 0;
for (; i < size; i++) {
check_downgrade(hash_map);
if (is_downgrade) {
break;
}

for (; !is_downgrade && i < size; i++) {
const auto& key = key_loader(i);
visited_keys.insert(key);
bool is_new_partition = false;
auto iter = hash_map.lazy_emplace(key, [&](const auto& ctor) {
is_new_partition = true;
return ctor(key_allocator(key), obj_pool->add(new PartitionChunks()));
});
if (is_new_partition) {
check_downgrade(hash_map);
}
auto& value = *(iter->second);
if (value.chunks.empty() || value.remain_size <= 0) {
if (!value.chunks.empty()) {
Expand Down Expand Up @@ -195,20 +195,21 @@ struct PartitionHashMapBase {
const auto size = chunk->num_rows();

uint32_t i = 0;
for (; i < size; i++) {
check_downgrade(hash_map);
if (is_downgrade) {
break;
}
for (; !is_downgrade && i < size; i++) {
PartitionChunks* value_ptr = nullptr;
if (null_flag_data[i] == 1) {
value_ptr = &null_key_value;
} else {
const auto& key = key_loader(i);
visited_keys.insert(key);
bool is_new_partition = false;
auto iter = hash_map.lazy_emplace(key, [&](const auto& ctor) {
is_new_partition = true;
return ctor(key_allocator(key), obj_pool->add(new PartitionChunks()));
});
if (is_new_partition) {
check_downgrade(hash_map);
}
value_ptr = iter->second;
}

Expand Down

0 comments on commit ca42225

Please sign in to comment.