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

Method Merge

bolt/exec/Merge.cpp:40–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38namespace bytedance::bolt::exec {
39
40Merge::Merge(
41 int32_t operatorId,
42 DriverCtx* driverCtx,
43 RowTypePtr outputType,
44 const std::vector<std::shared_ptr<const core::FieldAccessTypedExpr>>&
45 sortingKeys,
46 const std::vector<core::SortOrder>& sortingOrders,
47 const std::string& planNodeId,
48 const std::string& operatorType,
49 const std::optional<common::SpillConfig>& spillConfig)
50 : SourceOperator(
51 driverCtx,
52 std::move(outputType),
53 operatorId,
54 planNodeId,
55 operatorType,
56 spillConfig),
57 maxOutputBatchRows_{outputBatchRows()},
58 maxOutputBatchBytes_{
59 driverCtx->queryConfig().preferredOutputBatchBytes()},
60 sortingKeys_([&]() {
61 auto numKeys = sortingKeys.size();
62 std::vector<SpillSortKey> keys;
63 keys.reserve(numKeys);
64 for (int i = 0; i < numKeys; ++i) {
65 auto channel = exprToChannel(sortingKeys[i].get(), outputType_);
66 BOLT_CHECK_NE(
67 channel,
68 kConstantChannel,
69 "Merge doesn't allow constant grouping keys");
70 keys.emplace_back(
71 channel,
72 CompareFlags{
73 sortingOrders[i].isNullsFirst(),
74 sortingOrders[i].isAscending(),
75 false});
76 }
77 return keys;
78 }()) {}
79
80void Merge::initialize() {
81 Operator::initialize();

Callers

nothing calls this directly

Calls 7

exprToChannelFunction · 0.85
isNullsFirstMethod · 0.80
isAscendingMethod · 0.80
sizeMethod · 0.45
reserveMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected