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

Function compileInputs

bolt/expression/ExprCompiler.cpp:203–629  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

201
202#ifdef ENABLE_BOLT_EXPR_JIT
203std::vector<ExprPtr> compileInputs(
204 const TypedExprPtr& expr,
205 Scope* scope,
206 const core::QueryConfig& config,
207 memory::MemoryPool* pool,
208 const std::unordered_set<std::string>& flatteningCandidates,
209 bool enableConstantFolding,
210 bool isRootExpr = false) {
211#else
212std::vector<ExprPtr> compileInputs(
213 const TypedExprPtr& expr,
214 Scope* scope,
215 const core::QueryConfig& config,
216 memory::MemoryPool* pool,
217 const std::unordered_set<std::string>& flatteningCandidates,
218 bool enableConstantFolding) {
219#endif
220 std::vector<ExprPtr> compiledInputs;
221 auto flattenIf = shouldFlatten(expr, flatteningCandidates);
222 for (auto& input : expr->inputs()) {
223 if (dynamic_cast<const core::InputTypedExpr*>(input.get())) {
224 BOLT_CHECK(
225 dynamic_cast<const core::FieldAccessTypedExpr*>(expr.get()),
226 "An InputReference can only occur under a FieldReference");
227 } else {
228 if (flattenIf.has_value()) {
229 std::vector<TypedExprPtr> flat;
230 flattenInput(input, flattenIf.value(), flat);
231 for (auto& input_2 : flat) {
232 compiledInputs.push_back(compileExpression(
233 input_2,
234 scope,
235 config,
236 pool,
237 flatteningCandidates,
238 enableConstantFolding));
239 }
240 } else {
241 compiledInputs.push_back(compileExpression(
242 input,
243 scope,
244 config,
245 pool,
246 flatteningCandidates,
247 enableConstantFolding));
248 }
249 }
250 }
251 return compiledInputs;
252}
253
254std::vector<TypePtr> getTypes(const std::vector<ExprPtr>& exprs) {
255 std::vector<TypePtr> types;
256 types.reserve(exprs.size());
257 for (auto& expr : exprs) {
258 types.emplace_back(expr->type());
259 }
260 return types;

Callers 1

Calls 7

shouldFlattenFunction · 0.85
flattenInputFunction · 0.85
compileExpressionFunction · 0.85
has_valueMethod · 0.80
getMethod · 0.45
valueMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected