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

Function compileFunctions

server/functions/framework/catalog.go:218–256  ·  view source on GitHub ↗

compileFunctions creates a CompiledFunction for each overload of each function in the catalog.

()

Source from the content-addressed store, hash-verified

216
217// compileFunctions creates a CompiledFunction for each overload of each function in the catalog.
218func compileFunctions() {
219 for funcName, overloads := range Catalog {
220 compileNonOperatorFunction(funcName, overloads)
221 }
222
223 // Build the overload for all unary and binary functions based on their operator. This will be used for fallback if
224 // an exact match is not found. Compiled functions (which wrap the overload deducer) handle upcasting and other
225 // special rules, so it's far more efficient to reuse it for operators. Operators are also a special case since they
226 // all have different names, while standard overload deducers work on a function-name basis.
227 for signature, functionOverload := range unaryFunctions {
228 overloads, ok := unaryOperatorOverloads[signature.Operator]
229 if !ok {
230 overloads = NewOverloads()
231 unaryOperatorOverloads[signature.Operator] = overloads
232 }
233 if err := overloads.Add(functionOverload); err != nil {
234 panic(err)
235 }
236 }
237
238 for signature, functionOverload := range binaryFunctions {
239 overloads, ok := binaryOperatorOverloads[signature.Operator]
240 if !ok {
241 overloads = NewOverloads()
242 binaryOperatorOverloads[signature.Operator] = overloads
243 }
244 if err := overloads.Add(functionOverload); err != nil {
245 panic(err)
246 }
247 }
248
249 // Add all permutations for the unary and binary operators
250 for operator, overload := range unaryOperatorOverloads {
251 unaryOperatorPermutations[operator] = overload.overloadsForParams(1)
252 }
253 for operator, overload := range binaryOperatorOverloads {
254 binaryOperatorPermutations[operator] = overload.overloadsForParams(2)
255 }
256}
257
258func compileAggs() {
259 for funcName, overloads := range AggregateCatalog {

Callers 1

InitializeFunction · 0.85

Calls 4

NewOverloadsFunction · 0.85
overloadsForParamsMethod · 0.80
AddMethod · 0.45

Tested by

no test coverage detected