isNumericZero returns true if the datum is a number and equal to zero.
(expr TypedExpr)
| 762 | // isNumericZero returns true if the datum is a number and equal to |
| 763 | // zero. |
| 764 | func (v *NormalizeVisitor) isNumericZero(expr TypedExpr) bool { |
| 765 | if d, ok := expr.(Datum); ok { |
| 766 | switch t := UnwrapDatum(v.ctx, d).(type) { |
| 767 | case *DDecimal: |
| 768 | return t.Decimal.Sign() == 0 |
| 769 | case *DFloat: |
| 770 | return *t == 0 |
| 771 | case *DInt: |
| 772 | return *t == 0 |
| 773 | } |
| 774 | } |
| 775 | return false |
| 776 | } |
| 777 | |
| 778 | // isNumericOne returns true if the datum is a number and equal to |
| 779 | // one. |
no test coverage detected