Compare implements the Datum interface.
(ctx *EvalContext, other Datum)
| 3355 | |
| 3356 | // Compare implements the Datum interface. |
| 3357 | func (d *DArray) Compare(ctx *EvalContext, other Datum) int { |
| 3358 | if other == DNull { |
| 3359 | // NULL is less than any non-NULL value. |
| 3360 | return 1 |
| 3361 | } |
| 3362 | v, ok := UnwrapDatum(ctx, other).(*DArray) |
| 3363 | if !ok { |
| 3364 | panic(makeUnsupportedComparisonMessage(d, other)) |
| 3365 | } |
| 3366 | n := d.Len() |
| 3367 | if n > v.Len() { |
| 3368 | n = v.Len() |
| 3369 | } |
| 3370 | for i := 0; i < n; i++ { |
| 3371 | c := d.Array[i].Compare(ctx, v.Array[i]) |
| 3372 | if c != 0 { |
| 3373 | return c |
| 3374 | } |
| 3375 | } |
| 3376 | if d.Len() < v.Len() { |
| 3377 | return -1 |
| 3378 | } |
| 3379 | if d.Len() > v.Len() { |
| 3380 | return 1 |
| 3381 | } |
| 3382 | return 0 |
| 3383 | } |
| 3384 | |
| 3385 | // Prev implements the Datum interface. |
| 3386 | func (d *DArray) Prev(_ *EvalContext) (Datum, bool) { |
nothing calls this directly
no test coverage detected