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

Function initArrayElementConcatenation

postgres/parser/sem/tree/eval.go:207–226  ·  view source on GitHub ↗

TODO(justin): these might be improved by making arrays into an interface and then introducing a ConcatenatedArray implementation which just references two existing arrays. This would optimize the common case of appending an element (or array) to an array from O(n) to O(1).

()

Source from the content-addressed store, hash-verified

205// existing arrays. This would optimize the common case of appending an element
206// (or array) to an array from O(n) to O(1).
207func initArrayElementConcatenation() {
208 for _, t := range types.Scalar {
209 typ := t
210 BinOps[Concat] = append(BinOps[Concat], &BinOp{
211 LeftType: types.MakeArray(typ),
212 RightType: typ,
213 ReturnType: types.MakeArray(typ),
214 NullableArgs: true,
215 Volatility: VolatilityImmutable,
216 })
217
218 BinOps[Concat] = append(BinOps[Concat], &BinOp{
219 LeftType: typ,
220 RightType: types.MakeArray(typ),
221 ReturnType: types.MakeArray(typ),
222 NullableArgs: true,
223 Volatility: VolatilityImmutable,
224 })
225 }
226}
227
228func initArrayToArrayConcatenation() {
229 for _, t := range types.Scalar {

Callers 1

initFunction · 0.85

Calls 1

MakeArrayFunction · 0.92

Tested by

no test coverage detected