| 995 | }; |
| 996 | |
| 997 | VectorPtr 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 | |
| 1024 | TEST_F(SimpleFunctionTest, variadicReuseFirstArg) { |
| 1025 | std::string functionName = "function_with_variadic"; |
no test coverage detected