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

Method initialize

bolt/exec/FilterProject.cpp:121–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119 "FilterProject"),
120 hasFilter_(filter != nullptr),
121 driverCtx_(driverCtx),
122 project_(project),
123 filter_(filter),
124 acceptCompositeInput_(
125 driverCtx->queryConfig().isHashAggregationCompositeOutputEnabled()),
126 skipForCompositeInput_(type == ProjectType::kSkipCompositeRowVector) {
127 if (filter_ != nullptr && project_ != nullptr) {
128 folly::Synchronized<OperatorStats>& opStats = Operator::stats();
129 opStats.withWLock([&](auto& stats) {
130 stats.setStatSplitter(
131 [filterId = filter_->id()](const auto& combinedStats) {
132 return splitStats(combinedStats, filterId);
133 });
134 });
135 }
136}
137
138void FilterProject::initialize() {
139 Operator::initialize();
140 std::vector<core::TypedExprPtr> allExprs;
141 if (hasFilter_) {
142 BOLT_CHECK_NOT_NULL(filter_);
143 allExprs.push_back(filter_->filter());
144 }
145 if (project_) {
146 const auto& inputType = project_->sources()[0]->outputType();
147 for (column_index_t i = 0; i < project_->projections().size(); i++) {
148 auto& projection = project_->projections()[i];
149 bool identityProjection = checkAddIdentityProjection(
150 projection, inputType, i, identityProjections_);
151 if (!identityProjection) {
152 allExprs.push_back(projection);
153 resultProjections_.emplace_back(allExprs.size() - 1, i);
154 }
155 }
156 } else {
157 for (column_index_t i = 0; i < outputType_->size(); ++i) {
158 identityProjections_.emplace_back(i, i);
159 }
160 isIdentityProjection_ = true;
161 }
162 {
163 std::unordered_map<column_index_t, size_t> inputChannelCounts;
164 for (const auto& projection : identityProjections_) {
165 ++inputChannelCounts[projection.inputChannel];
166 }
167 for (const auto& [inputChannel, count] : inputChannelCounts) {
168 if (count > 1) {

Callers

nothing calls this directly

Calls 14

makeExprSetFromFlagFunction · 0.85
outputTypeMethod · 0.80
getChildIdxMethod · 0.80
push_backMethod · 0.45
filterMethod · 0.45
sizeMethod · 0.45
execCtxMethod · 0.45
emptyMethod · 0.45
nameMethod · 0.45
insertMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected