Skip to content

Commit

Permalink
[Enhancement] enable adaptive partition hash join by default (StarRoc…
Browse files Browse the repository at this point in the history
…ks#51224)

Signed-off-by: stdpain <drfeng08@gmail.com>
  • Loading branch information
stdpain authored Sep 27, 2024
1 parent 65f3007 commit 26de537
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion be/src/exec/hash_join_components.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ int64_t AdaptivePartitionHashJoinBuilder::ht_mem_usage() const {

Status AdaptivePartitionHashJoinBuilder::_convert_to_single_partition() {
// merge all partition data to the first partition
for (size_t i = 1; i < _partition_num; ++i) {
for (size_t i = 1; i < _builders.size(); ++i) {
_builders[0]->hash_table().merge_ht(_builders[i]->hash_table());
}
_builders.resize(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,13 +249,18 @@ StatusOr<std::function<StatusOr<ChunkPtr>()>> SpillableHashJoinBuildOperator::_c

return [this]() -> StatusOr<ChunkPtr> {
if (_hash_table_build_chunk_slice.empty()) {
if (_hash_table_iterate_idx + 1 >= _hash_tables.size()) {
_hash_table_iterate_idx++;
for (; _hash_table_iterate_idx < _hash_tables.size(); _hash_table_iterate_idx++) {
auto build_chunk = _hash_tables[_hash_table_iterate_idx]->get_build_chunk();
if (build_chunk->num_rows() > 0) {
_hash_table_build_chunk_slice.reset(build_chunk);
_hash_table_build_chunk_slice.skip(kHashJoinKeyColumnOffset);
break;
}
}
if (_hash_table_build_chunk_slice.empty()) {
_join_builder->hash_join_builder()->reset(_join_builder->hash_table_param());
return Status::EndOfFile("eos");
} else {
_hash_table_iterate_idx++;
_hash_table_build_chunk_slice.reset(_hash_tables[_hash_table_iterate_idx]->get_build_chunk());
_hash_table_build_chunk_slice.skip(kHashJoinKeyColumnOffset);
}
}

Expand Down
2 changes: 2 additions & 0 deletions be/src/types/logical_type_infra.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ auto type_dispatch_all(LogicalType ltype, Functor fun, Args... args) {
switch (ltype) {
APPLY_FOR_ALL_SCALAR_TYPE_WITH_NULL(_TYPE_DISPATCH_CASE)
_TYPE_DISPATCH_CASE(TYPE_ARRAY)
_TYPE_DISPATCH_CASE(TYPE_STRUCT)
_TYPE_DISPATCH_CASE(TYPE_MAP)
_TYPE_DISPATCH_CASE(TYPE_HLL)
_TYPE_DISPATCH_CASE(TYPE_OBJECT)
_TYPE_DISPATCH_CASE(TYPE_PERCENTILE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1263,7 +1263,7 @@ public static MaterializedViewRewriteMode parse(String str) {
private boolean joinLateMaterialization = false;

@VariableMgr.VarAttr(name = ENABLE_PARTITION_HASH_JOIN)
private boolean enablePartitionHashJoin = false;
private boolean enablePartitionHashJoin = true;

@VariableMgr.VarAttr(name = ENABLE_PRUNE_COLUMN_AFTER_INDEX_FILTER, flag = VariableMgr.INVISIBLE)
private boolean enablePruneColumnAfterIndexFilter = true;
Expand Down

0 comments on commit 26de537

Please sign in to comment.