MCPcopy Create free account
hub / github.com/dolthub/doltgresql / compileNonOperatorFunction

Function compileNonOperatorFunction

server/functions/framework/catalog.go:174–192  ·  view source on GitHub ↗

compileNonOperatorFunction creates a CompiledFunction for each overload of the given function.

(funcName string, overloads []FunctionInterface)

Source from the content-addressed store, hash-verified

172
173// compileNonOperatorFunction creates a CompiledFunction for each overload of the given function.
174func compileNonOperatorFunction(funcName string, overloads []FunctionInterface) {
175 overloadTree := NewOverloads()
176 for _, functionOverload := range overloads {
177 if err := overloadTree.Add(functionOverload); err != nil {
178 panic(err)
179 }
180 }
181
182 // Store the compiled function into the engine's built-in functions
183 // TODO: don't do this, use an actual contract for communicating these functions to the engine catalog
184 createFunc := func(ctx *sql.Context, params ...sql.Expression) (sql.Expression, error) {
185 return NewCompiledFunction(ctx, funcName, params, overloadTree, false), nil
186 }
187 function.BuiltIns = append(function.BuiltIns, sql.FunctionN{
188 Name: funcName,
189 Fn: createFunc,
190 })
191 compiledCatalog[funcName] = createFunc
192}
193
194// compileNonOperatorFunction creates a CompiledFunction for each overload of the given function.
195func compileAggFunction(funcName string, overloads []AggregateFunctionInterface) {

Callers 1

compileFunctionsFunction · 0.85

Calls 3

AddMethod · 0.95
NewOverloadsFunction · 0.85
NewCompiledFunctionFunction · 0.85

Tested by

no test coverage detected