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

Method Compare

pkg/sql/sem/tree/datum.go:160–180  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

158// is less than other, 0 if receiver is equal to other and +1 if receiver is
159// greater than other.
160func (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

Callers

nothing calls this directly

Calls 1

CompareMethod · 0.65

Tested by

no test coverage detected