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

Function testVariadicArgReuse

bolt/expression/tests/SimpleFunctionTest.cpp:997–1022  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

995};
996
997VectorPtr testVariadicArgReuse(
998 core::ExecCtx* execCtx,
999 VectorMaker& vectorMaker,
1000 std::vector<VectorPtr>& inputs,
1001 const std::string& functionName,
1002 const TypePtr& outputType) {
1003 // This is a bit of a round about way of creating the SimpleFunctionAdapter,
1004 // especially since it requires the caller to register the function as well,
1005 // but it should be easier to maintain.
1006 auto function =
1007 exec::simpleFunctions()
1008 .resolveFunction(functionName, {})
1009 ->createFunction()
1010 ->createVectorFunction({}, {}, execCtx->queryCtx()->queryConfig());
1011
1012 // Create a dummy EvalCtx.
1013 SelectivityVector rows(inputs[0]->size());
1014 exec::ExprSet exprSet({}, execCtx);
1015 RowVectorPtr inputRows = vectorMaker.rowVector({});
1016 exec::EvalCtx evalCtx(execCtx, &exprSet, inputRows.get());
1017
1018 VectorPtr resultPtr;
1019 function->apply(rows, inputs, outputType, evalCtx, resultPtr);
1020
1021 return resultPtr;
1022}
1023
1024TEST_F(SimpleFunctionTest, variadicReuseFirstArg) {
1025 std::string functionName = "function_with_variadic";

Callers 1

TEST_FFunction · 0.85

Calls 8

createVectorFunctionMethod · 0.80
resolveFunctionMethod · 0.80
queryCtxMethod · 0.80
rowVectorMethod · 0.80
createFunctionMethod · 0.45
sizeMethod · 0.45
getMethod · 0.45
applyMethod · 0.45

Tested by

no test coverage detected