isNumericOne returns true if the datum is a number and equal to one.
(expr TypedExpr)
| 778 | // isNumericOne returns true if the datum is a number and equal to |
| 779 | // one. |
| 780 | func (v *NormalizeVisitor) isNumericOne(expr TypedExpr) bool { |
| 781 | if d, ok := expr.(Datum); ok { |
| 782 | switch t := UnwrapDatum(v.ctx, d).(type) { |
| 783 | case *DDecimal: |
| 784 | return t.Decimal.Cmp(&DecimalOne.Decimal) == 0 |
| 785 | case *DFloat: |
| 786 | return *t == 1.0 |
| 787 | case *DInt: |
| 788 | return *t == 1 |
| 789 | } |
| 790 | } |
| 791 | return false |
| 792 | } |
| 793 | |
| 794 | func invertComparisonOp(op ComparisonOperator) (ComparisonOperator, error) { |
| 795 | switch op { |
no test coverage detected