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

Method fillOutput

bolt/exec/HashProbe.cpp:904–971  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

902}
903
904void HashProbe::fillOutput(vector_size_t size) {
905 prepareOutput(size);
906 for (auto projection : projectedInputColumns_) {
907 ensureLoadedIfNotAtEnd(projection.inputChannel);
908 }
909
910 wrapIndirectChildren(
911 projectedInputColumns_,
912 input_->children(),
913 size,
914 outputRowMapping_,
915 output_->children());
916
917 if (isLeftSemiProjectJoin(joinType_)) {
918 fillLeftSemiProjectMatchColumn(size);
919 } else {
920 bool wrapInDictionary = false;
921 std::map<int64_t, int16_t> addrToIndex;
922 // if size too small, no need to sample
923 if (hitSampling_ && size > 1024) {
924 wrapInDictionary = canWrapInDictionary(size, addrToIndex);
925 }
926 if (wrapInDictionary) {
927 auto numDistinct = addrToIndex.size();
928 std::vector<char*> distinctRows(numDistinct);
929 for (const auto& [addr, idx] : addrToIndex) {
930 distinctRows[idx] = (char*)addr;
931 }
932 // get dictionary raw value
933 RowVectorPtr dictOutput = std::static_pointer_cast<RowVector>(
934 BaseVector::create(outputType_, numDistinct, pool()));
935 // Disable sorting when there are probe columns to keep build and probe in
936 // sync.
937 const bool hasProbeColumns = !projectedInputColumns_.empty();
938 extractColumns(
939 table_.get(),
940 folly::Range<char**>(distinctRows.data(), numDistinct),
941 tableOutputProjections_,
942 pool(),
943 outputType_->children(),
944 dictOutput->children(),
945 /*allowSorting=*/!hasProbeColumns);
946
947 // calculate dictionary index
948 BufferPtr indexBuffer;
949 auto mapping = initializeRowNumberMapping(indexBuffer, size, pool());
950 for (auto i = 0; i < size; ++i) {
951 mapping[i] = addrToIndex.find((int64_t)(outputTableRows_[i]))->second;
952 }
953 for (auto projection : tableOutputProjections_) {
954 output_->childAt(projection.outputChannel) = wrapChild(
955 size, indexBuffer, dictOutput->childAt(projection.outputChannel));
956 }
957 } else {
958 // Disable sorting when there are probe columns to keep build and probe in
959 // sync.
960 const bool hasProbeColumns = !projectedInputColumns_.empty();
961 extractColumns(

Callers

nothing calls this directly

Calls 14

wrapIndirectChildrenFunction · 0.85
isLeftSemiProjectJoinFunction · 0.85
extractColumnsFunction · 0.85
wrapChildFunction · 0.85
childAtMethod · 0.80
createFunction · 0.50
poolFunction · 0.50
childrenMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected