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

Method noMoreInput

bolt/exec/SortBuffer.cpp:212–295  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210}
211
212void SortBuffer::noMoreInput() {
213 bolt::common::testutil::TestValue::adjust(
214 "bytedance::bolt::exec::SortBuffer::noMoreInput", this);
215 BOLT_CHECK(!noMoreInput_);
216 noMoreInput_ = true;
217
218 // No data.
219 if (numInputRows_ == 0) {
220 return;
221 }
222 if (hybridSortEnabled_ && hybridData_ != nullptr && !scatteredMode_) {
223 hybridData_->coalesceBatches();
224 }
225
226 if (spiller_ == nullptr) {
227 BOLT_CHECK_EQ(numInputRows_, data_->numRows());
228 updateEstimatedOutputRowSize();
229 // Sort the pointers to the rows in RowContainer (data_) instead of sorting
230 // the rows.
231 // TODO: Reuse 'RowContainer::rowPointers_'.
232 sortedRows_.resize(numInputRows_);
233 RowContainerIterator iter;
234 data_->listRows(&iter, numInputRows_, sortedRows_.data());
235
236 MicrosecondTimer timer(&sortInSortTimeUs_);
237
238#ifdef ENABLE_BOLT_JIT
239 if (cmp_ == nullptr && operatorCtx_ &&
240 operatorCtx_->driverCtx()->queryConfig().enableJitRowCmpRow()) {
241 if (data_->JITable(data_->keyTypes())) {
242 auto [jitMod, rowRowCmpfn] = data_->codegenCompare(
243 data_->keyTypes(),
244 sortCompareFlags_,
245 bytedance::bolt::jit::CmpType::SORT_LESS,
246 true);
247 jitModule_ = std::move(jitMod);
248 cmp_ = (RowRowCompare)jitModule_->getFuncPtr(rowRowCmpfn);
249 }
250 }
251 if (cmp_) {
252 sorter_.sort(sortedRows_.begin(), sortedRows_.end(), cmp_);
253 } else {
254#endif
255
256#ifdef ENABLE_META_SORT
257 MetaRowsSorterWraper<BufferRows>::MetaCodegenSort(
258 sortedRows_,
259 data_.get(),
260 sorter_,
261 data_->keyIndices(),
262 sortCompareFlags_);
263#else
264 sorter_.sort(
265 sortedRows_.begin(),
266 sortedRows_.end(),
267 [this](const char* leftRow, const char* rightRow) {
268 for (vector_size_t index = 0; index < sortCompareFlags_.size();
269 ++index) {

Callers

nothing calls this directly

Calls 15

coalesceBatchesMethod · 0.80
enableJitRowCmpRowMethod · 0.80
JITableMethod · 0.80
codegenCompareMethod · 0.80
getFuncPtrMethod · 0.80
numRowsMethod · 0.45
resizeMethod · 0.45
listRowsMethod · 0.45
dataMethod · 0.45
driverCtxMethod · 0.45
sortMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected