| 370 | } |
| 371 | |
| 372 | void Window::createWindowFunctionsForSpillableWindowBuild() { |
| 373 | const auto& inputType = windowNode_->sources()[0]->outputType(); |
| 374 | std::vector<std::unique_ptr<exec::WindowFunction>> windowFunctions; |
| 375 | for (const auto& windowNodeFunction : windowNode_->windowFunctions()) { |
| 376 | std::vector<WindowFunctionArg> functionArgs; |
| 377 | functionArgs.reserve(windowNodeFunction.functionCall->inputs().size()); |
| 378 | for (auto& arg : windowNodeFunction.functionCall->inputs()) { |
| 379 | auto channel = exprToChannel(arg.get(), inputType); |
| 380 | if (channel == kConstantChannel) { |
| 381 | auto constantArg = core::TypedExprs::asConstant(arg); |
| 382 | functionArgs.push_back( |
| 383 | {arg->type(), |
| 384 | constantArg->toConstantVector(memory::spillMemoryPool()), |
| 385 | std::nullopt}); |
| 386 | } else { |
| 387 | functionArgs.push_back({arg->type(), nullptr, channel}); |
| 388 | } |
| 389 | } |
| 390 | |
| 391 | windowFunctions.push_back(WindowFunction::create( |
| 392 | windowNodeFunction.functionCall->name(), |
| 393 | functionArgs, |
| 394 | windowNodeFunction.functionCall->type(), |
| 395 | windowNodeFunction.ignoreNulls, |
| 396 | memory::spillMemoryPool(), |
| 397 | &stringAllocator_, |
| 398 | operatorCtx_->driverCtx()->queryConfig())); |
| 399 | } |
| 400 | if (needSort_) { |
| 401 | dynamic_cast<SpillableWindowBuild<true>*>(windowBuild_.get()) |
| 402 | ->setWindowFunction(std::move(windowFunctions)); |
| 403 | } else { |
| 404 | dynamic_cast<SpillableWindowBuild<false>*>(windowBuild_.get()) |
| 405 | ->setWindowFunction(std::move(windowFunctions)); |
| 406 | } |
| 407 | } |
| 408 | |
| 409 | // Support 'rank' and |
| 410 | // 'row_number' functions and the agg window function with default frame. |
nothing calls this directly
no test coverage detected