Compare does a lexicographical comparison and returns -1 if the receiver is less than other, 0 if receiver is equal to other and +1 if receiver is greater than other.
(evalCtx *EvalContext, other Datums)
| 158 | // is less than other, 0 if receiver is equal to other and +1 if receiver is |
| 159 | // greater than other. |
| 160 | func (d Datums) Compare(evalCtx *EvalContext, other Datums) int { |
| 161 | if len(d) == 0 { |
| 162 | panic(errors.AssertionFailedf("empty Datums being compared to other")) |
| 163 | } |
| 164 | |
| 165 | for i := range d { |
| 166 | if i >= len(other) { |
| 167 | return 1 |
| 168 | } |
| 169 | |
| 170 | compareDatum := d[i].Compare(evalCtx, other[i]) |
| 171 | if compareDatum != 0 { |
| 172 | return compareDatum |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | if len(d) < len(other) { |
| 177 | return -1 |
| 178 | } |
| 179 | return 0 |
| 180 | } |
| 181 | |
| 182 | // IsDistinctFrom checks to see if two datums are distinct from each other. Any |
| 183 | // change in value is considered distinct, however, a NULL value is NOT |