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

Method createWindowFunctionsForSpillableWindowBuild

bolt/exec/Window.cpp:372–407  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

370}
371
372void 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.

Callers

nothing calls this directly

Calls 13

exprToChannelFunction · 0.85
spillMemoryPoolFunction · 0.85
outputTypeMethod · 0.80
toConstantVectorMethod · 0.80
setWindowFunctionMethod · 0.80
createFunction · 0.50
reserveMethod · 0.45
sizeMethod · 0.45
getMethod · 0.45
push_backMethod · 0.45
typeMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected