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

Method create

bolt/exec/WindowFunction.cpp:83–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81}
82
83std::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
124void WindowFunction::setEmptyFramesResult(
125 const SelectivityVector& validRows,

Callers

nothing calls this directly

Calls 10

getWindowFunctionEntryFunction · 0.85
toStringFunction · 0.50
reserveMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45
valueMethod · 0.45
tryBindMethod · 0.45
tryResolveTypeMethod · 0.45
equivalentMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected