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

Method supportedNonAggWindowFuncOffsetBySpill

bolt/exec/Window.cpp:1091–1124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1089}
1090
1091bool Window::supportedNonAggWindowFuncOffsetBySpill(
1092 const core::WindowNode::Function& windowNodeFunction) {
1093 auto numArgs = windowNodeFunction.functionCall->inputs().size();
1094 if (UNLIKELY(numArgs == 0)) {
1095 return false;
1096 }
1097 if (numArgs == 1) {
1098 return true;
1099 }
1100 const auto& inputType = windowNode_->sources()[0]->outputType();
1101 auto& arg = windowNodeFunction.functionCall->inputs()[1];
1102 auto channel = exprToChannel(arg.get(), inputType);
1103 if (channel == kConstantChannel) {
1104 const auto& constantArg = core::TypedExprs::asConstant(arg);
1105 const auto& constantVector = constantArg->toConstantVector(pool());
1106 if (constantVector->isNullAt(0)) {
1107 return true;
1108 }
1109 if (arg->type()->kind() == TypeKind::INTEGER) {
1110 if (constantVector->as<ConstantVector<int32_t>>()->valueAt(0) >= 2) {
1111 return false;
1112 }
1113 }
1114 if (arg->type()->kind() == TypeKind::BIGINT) {
1115 if (constantVector->as<ConstantVector<int64_t>>()->valueAt(0) >= 2) {
1116 return false;
1117 }
1118 }
1119 } else {
1120 // offset if not constant
1121 return false;
1122 }
1123 return true;
1124}
1125
1126void Window::recordWindowStats() {
1127 auto spillStats = windowBuild_->spilledStats();

Callers

nothing calls this directly

Calls 10

exprToChannelFunction · 0.85
outputTypeMethod · 0.80
toConstantVectorMethod · 0.80
poolFunction · 0.50
sizeMethod · 0.45
getMethod · 0.45
isNullAtMethod · 0.45
kindMethod · 0.45
typeMethod · 0.45
valueAtMethod · 0.45

Tested by

no test coverage detected