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

Function flattenTopLevelConjuncts

bolt/expression/ExprToSubfieldFilter.cpp:138–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136}
137
138void flattenTopLevelConjuncts(
139 const core::TypedExprPtr& expr,
140 std::vector<core::TypedExprPtr>& conjuncts) {
141 std::vector<core::TypedExprPtr> pending;
142 if (expr) {
143 pending.push_back(expr);
144 }
145
146 while (!pending.empty()) {
147 auto current = std::move(pending.back());
148 pending.pop_back();
149 if (!current) {
150 continue;
151 }
152 auto call = std::dynamic_pointer_cast<const core::CallTypedExpr>(current);
153 if (call && call->name() == "and") {
154 const auto& inputs = call->inputs();
155 for (size_t i = inputs.size(); i > 0; --i) {
156 pending.push_back(inputs[i - 1]);
157 }
158 continue;
159 }
160 conjuncts.push_back(std::move(current));
161 }
162}
163
164std::vector<core::TypedExprPtr> flattenTopLevelConjuncts(
165 const core::TypedExprPtr& expr) {

Callers 3

planFilterFunction · 0.85
toSubfieldFiltersMethod · 0.85
TEST_FFunction · 0.85

Calls 6

backMethod · 0.80
pop_backMethod · 0.80
push_backMethod · 0.45
emptyMethod · 0.45
nameMethod · 0.45
sizeMethod · 0.45

Tested by 1

TEST_FFunction · 0.68