MCPcopy Create free account
hub / github.com/bytedance/bolt / adjustBypassHashTable

Method adjustBypassHashTable

bolt/exec/GroupingSet.cpp:1133–1157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1131 spiller_->setSpillConfig(spillConfig_);
1132 BOLT_CHECK_EQ(spiller_->state().maxPartitions(), 1);
1133 }
1134 LOG(INFO) << operatorCtx_->toString()
1135 << " spill row container, row number: " << table_->rows()->numRows()
1136 << ", bytes: " << table_->rows()->allocatedBytes()
1137 << ", probe ratio = " << table_->getDistinctRatio();
1138 spiller_->spill();
1139 if (isDistinct() && numDistinctSpilledFiles_ == 0) {
1140 numDistinctSpilledFiles_ = spiller_->state().numFinishedFiles(0);
1141 BOLT_CHECK_GT(numDistinctSpilledFiles_, 0);
1142 }
1143 if (sortedAggregations_) {
1144 sortedAggregations_->clear();
1145 }
1146 adjustBypassHashTable(spillConf);
1147 table_->clear();
1148}
1149
1150void GroupingSet::adjustBypassHashTable(common::SpillConfig* spillConf) {
1151 // enable if rowbased spill and
1152 // 1. less next equal rows in sorted rows if bypassed
1153 // 2. too many distinct keys from hash tables if not bypassed
1154 bool oldBypassProbeHT = bypassProbeHT_;
1155 bypassProbeHT_ = spillConfig_ &&
1156 spillConfig_->rowBasedSpillMode != common::RowBasedSpillMode::DISABLE &&
1157 (oldBypassProbeHT
1158 ? table_->rows()->numRows() - spillConf->aggBypassHTEqualNum >=
1159 table_->rows()->numRows() * bypassHTDistinctRatio_
1160 : table_->getDistinctRatio() >= bypassHTDistinctRatio_);

Callers

nothing calls this directly

Calls 4

getDistinctRatioMethod · 0.80
probedFlagOffsetMethod · 0.80
numRowsMethod · 0.45
rowsMethod · 0.45

Tested by

no test coverage detected