CompareDecimals compares 2 apd.Decimals according to the SQL comparison rules, making sure that NaNs sort first.
(d *apd.Decimal, v *apd.Decimal)
| 969 | // CompareDecimals compares 2 apd.Decimals according to the SQL comparison |
| 970 | // rules, making sure that NaNs sort first. |
| 971 | func CompareDecimals(d *apd.Decimal, v *apd.Decimal) int { |
| 972 | // NaNs sort first in SQL. |
| 973 | if dn, vn := d.Form == apd.NaN, v.Form == apd.NaN; dn && !vn { |
| 974 | return -1 |
| 975 | } else if !dn && vn { |
| 976 | return 1 |
| 977 | } else if dn && vn { |
| 978 | return 0 |
| 979 | } |
| 980 | return d.Cmp(v) |
| 981 | } |
| 982 | |
| 983 | // Prev implements the Datum interface. |
| 984 | func (d *DDecimal) Prev(_ *EvalContext) (Datum, bool) { |
no outgoing calls
no test coverage detected
searching dependent graphs…