MCPcopy Create free account
hub / github.com/auxten/postgresql-parser / PickFromTuple

Function PickFromTuple

pkg/sql/sem/tree/eval.go:5368–5388  ·  view source on GitHub ↗

PickFromTuple picks the greatest (or least value) from a tuple.

(ctx *EvalContext, greatest bool, args Datums)

Source from the content-addressed store, hash-verified

5366
5367// PickFromTuple picks the greatest (or least value) from a tuple.
5368func PickFromTuple(ctx *EvalContext, greatest bool, args Datums) (Datum, error) {
5369 g := args[0]
5370 // Pick a greater (or smaller) value.
5371 for _, d := range args[1:] {
5372 var eval Datum
5373 var err error
5374 if greatest {
5375 eval, err = evalComparison(ctx, LT, g, d)
5376 } else {
5377 eval, err = evalComparison(ctx, LT, d, g)
5378 }
5379 if err != nil {
5380 return nil, err
5381 }
5382 if eval == DBoolTrue ||
5383 (eval == DNull && g == DNull) {
5384 g = d
5385 }
5386 }
5387 return g, nil
5388}
5389
5390//// CallbackValueGenerator is a ValueGenerator that calls a supplied callback for
5391//// producing the values. To be used with

Callers

nothing calls this directly

Calls 1

evalComparisonFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…