| 81 | } |
| 82 | |
| 83 | std::unique_ptr<WindowFunction> WindowFunction::create( |
| 84 | const std::string& name, |
| 85 | const std::vector<WindowFunctionArg>& args, |
| 86 | const TypePtr& resultType, |
| 87 | bool ignoreNulls, |
| 88 | memory::MemoryPool* pool, |
| 89 | HashStringAllocator* stringAllocator, |
| 90 | const core::QueryConfig& config) { |
| 91 | // Lookup the function in the new registry first. |
| 92 | if (auto func = getWindowFunctionEntry(name)) { |
| 93 | std::vector<TypePtr> argTypes; |
| 94 | argTypes.reserve(args.size()); |
| 95 | for (const auto& arg : args) { |
| 96 | argTypes.push_back(arg.type); |
| 97 | } |
| 98 | |
| 99 | const auto& signatures = func.value()->signatures; |
| 100 | for (auto& signature : signatures) { |
| 101 | SignatureBinder binder(*signature, argTypes); |
| 102 | if (binder.tryBind()) { |
| 103 | auto type = binder.tryResolveType(signature->returnType()); |
| 104 | BOLT_USER_CHECK( |
| 105 | type->equivalent(*resultType), |
| 106 | "Unexpected return type for window function {}. Expected {}. Got {}.", |
| 107 | toString(name, argTypes), |
| 108 | type->toString(), |
| 109 | resultType->toString()) |
| 110 | return func.value()->factory( |
| 111 | args, resultType, ignoreNulls, pool, stringAllocator, config); |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | BOLT_USER_FAIL( |
| 116 | "Window function signature is not supported: {}. Supported signatures: {}.", |
| 117 | toString(name, argTypes), |
| 118 | toString(signatures)); |
| 119 | } |
| 120 | |
| 121 | BOLT_USER_FAIL("Window function not registered: {}", name); |
| 122 | } |
| 123 | |
| 124 | void WindowFunction::setEmptyFramesResult( |
| 125 | const SelectivityVector& validRows, |
nothing calls this directly
no test coverage detected