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

Method initialize

bolt/exec/StreamingAggregation.cpp:63–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61}
62
63void StreamingAggregation::initialize() {
64 Operator::initialize();
65
66 auto numKeys = aggregationNode_->groupingKeys().size();
67 decodedKeys_.resize(numKeys);
68
69 auto inputType = aggregationNode_->sources()[0]->outputType();
70
71 std::vector<TypePtr> groupingKeyTypes;
72 groupingKeyTypes.reserve(numKeys);
73
74 groupingKeys_.reserve(numKeys);
75 for (const auto& key : aggregationNode_->groupingKeys()) {
76 auto channel = exprToChannel(key.get(), inputType);
77 groupingKeys_.push_back(channel);
78 groupingKeyTypes.push_back(inputType->childAt(channel));
79 }
80
81 std::shared_ptr<core::ExpressionEvaluator> expressionEvaluator;
82 aggregates_ = toAggregateInfo(
83 *aggregationNode_, *operatorCtx_, numKeys, expressionEvaluator, true);
84
85 // Setup SortedAggregations.
86 sortedAggregations_ =
87 SortedAggregations::create(aggregates_, inputType, pool());
88
89 distinctAggregations_.reserve(aggregates_.size());
90 for (auto& aggregate : aggregates_) {
91 if (aggregate.distinct) {
92 distinctAggregations_.emplace_back(
93 DistinctAggregations::create({&aggregate}, inputType, pool()));
94 } else {
95 distinctAggregations_.push_back(nullptr);
96 }
97 }
98
99 masks_ = std::make_unique<AggregationMasks>(extractMaskChannels(aggregates_));
100 rows_ = makeRowContainer(groupingKeyTypes);
101
102 initializeAggregates(numKeys);
103
104 aggregationNode_.reset();
105}
106
107void StreamingAggregation::close() {
108 if (rows_ != nullptr) {

Callers

nothing calls this directly

Calls 15

exprToChannelFunction · 0.85
toAggregateInfoFunction · 0.85
extractMaskChannelsFunction · 0.85
makeRowContainerFunction · 0.85
initializeAggregatesFunction · 0.85
outputTypeMethod · 0.80
childAtMethod · 0.80
createFunction · 0.50
poolFunction · 0.50
sizeMethod · 0.45
resizeMethod · 0.45
reserveMethod · 0.45

Tested by

no test coverage detected