IsDistinctFrom checks to see if two datums are distinct from each other. Any change in value is considered distinct, however, a NULL value is NOT considered disctinct from another NULL value.
(evalCtx *EvalContext, other Datums)
| 183 | // change in value is considered distinct, however, a NULL value is NOT |
| 184 | // considered disctinct from another NULL value. |
| 185 | func (d Datums) IsDistinctFrom(evalCtx *EvalContext, other Datums) bool { |
| 186 | if len(d) != len(other) { |
| 187 | return true |
| 188 | } |
| 189 | for i, val := range d { |
| 190 | if val == DNull { |
| 191 | if other[i] != DNull { |
| 192 | return true |
| 193 | } |
| 194 | } else { |
| 195 | if val.Compare(evalCtx, other[i]) != 0 { |
| 196 | return true |
| 197 | } |
| 198 | } |
| 199 | } |
| 200 | return false |
| 201 | } |
| 202 | |
| 203 | // CompositeDatum is a Datum that may require composite encoding in |
| 204 | // indexes. Any Datum implementing this interface must also add itself to |