| 1089 | } |
| 1090 | |
| 1091 | bool 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 | |
| 1126 | void Window::recordWindowStats() { |
| 1127 | auto spillStats = windowBuild_->spilledStats(); |
nothing calls this directly
no test coverage detected