This is an automated email from the ASF dual-hosted git repository.

voonhous pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hudi.git


The following commit(s) were added to refs/heads/master by this push:
     new 30249020e2fb fix(spark): guard data skipping through overflowing 
arithmetic (#20532)
30249020e2fb is described below

commit 30249020e2fb286f8053e1bbbbac1ea8ff6cff6c
Author: voonhous <[email protected]>
AuthorDate: Fri Nov 6 13:01:37 2026 +0800

    fix(spark): guard data skipping through overflowing arithmetic (#20532)
    
    * fix(spark): stop data skipping through overflowing arithmetic
    
    Data skipping re-applied Add, Multiply and ShiftLeft with a constant
    to a column's min/max stats. Without ANSI, integral arithmetic wraps
    around on overflow, so the max can map below the min
    (Long.MaxValue * 2 = -2) and files with matching rows were pruned.
    Decimal results overflow into NULL, which prunes the file as well.
    
    - Add and Multiply only match a float or double result, which rounds
      monotonically and saturates to infinity
    - ShiftLeft is no longer matched: it only takes integral values
    - The Add constant must be finite: -Infinity + Infinity = NaN, which
      sorts above every number
    
    Closes #20460
    
    * fix(spark): guard integral data skipping arithmetic per file
    
    Instead of rejecting integral Add, Multiply and ShiftLeft outright,
    give their steps a per-file guard that the file's min and max stay
    within the type's limits after the operation. A file that may
    overflow gets an unknown bound and is kept (#19474); every other
    file prunes as before. The bound is only evaluated when the guard
    holds, so ANSI does not throw.
    
    - ShiftLeft needs a constant shift amount (a << a is not
      order-preserving)
    - Decimal Add / Multiply stay rejected: they overflow into NULL
    - Overflow cases run through the full optimizer under ANSI on and
      off, with exact-limit pairs for +, * and shiftleft
    
    * fix(spark): range decimal arithmetic as partial steps
    
    Decimal Add, Multiply and Divide overflow into NULL (or throw under
    ANSI). Range them as partial steps, so an overflowing bound is NULL and
    the file is kept, instead of rejecting Add and Multiply outright.
    Divide was matched with partial = false, so an overflowing decimal
    quotient dropped files with matching rows.
    
    Also rename IntegralType to IntegralLimits (it shadowed Spark's
    IntegralType), note that ShiftLeft wraps around under ANSI too, and pin
    the shift mask widths and the smallint / tinyint limits in tests.
---
 .../dataskipping/rules/ConstantOperandRule.scala   | 174 ++++++++++++-
 .../data-skipping/golden-index-filters.txt         | 285 ++++++++++++---------
 .../org/apache/hudi/DataSkippingGoldenInputs.scala |  27 +-
 .../org/apache/hudi/TestDataSkippingUtils.scala    | 114 ++++++++-
 .../hudi/TestHoodieCatalystExpressionUtils.scala   |  72 +++++-
 5 files changed, 521 insertions(+), 151 deletions(-)

diff --git 
a/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/spark/sql/hudi/dataskipping/rules/ConstantOperandRule.scala
 
b/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/spark/sql/hudi/dataskipping/rules/ConstantOperandRule.scala
index b8eb93aa1bbc..09b42c047f6a 100644
--- 
a/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/spark/sql/hudi/dataskipping/rules/ConstantOperandRule.scala
+++ 
b/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/spark/sql/hudi/dataskipping/rules/ConstantOperandRule.scala
@@ -17,23 +17,38 @@
 
 package org.apache.spark.sql.hudi.dataskipping.rules
 
-import org.apache.spark.sql.catalyst.expressions.{Add, BitwiseOr, DateAdd, 
DateDiff, DateSub, Divide, Expression, Literal, Multiply, ShiftLeft, ShiftRight}
-import org.apache.spark.sql.hudi.dataskipping.{Increasing, RangeRule, Step}
-import org.apache.spark.sql.types.Decimal
+import org.apache.spark.sql.catalyst.expressions.{Add, And, BitwiseOr, 
DateAdd, DateDiff, DateSub, Divide, Expression, GreaterThanOrEqual, 
LessThanOrEqual, Literal, Multiply, ShiftLeft, ShiftRight}
+import org.apache.spark.sql.hudi.dataskipping.{Increasing, RangeRule, Step, 
TermRange}
+import org.apache.spark.sql.types.{ByteType, DataType, Decimal, DecimalType, 
DoubleType, FloatType, IntegerType, LongType, ShortType}
+
+import scala.util.Try
 
 /**
  * Binary operators with the column on one side and a constant on the other:
  * `Add`, `Multiply`, `Divide`, `DateAdd`, `DateSub`, `DateDiff`, `ShiftLeft`, 
`ShiftRight`, `BitwiseOr`.
  *
  * Shared guard: the other operand is constant. Today that is enforced per 
function:
- *  - `Add`: the other side is foldable (either side)
- *  - `Multiply`: the other side is a positive numeric literal (either side)
+ *  - `Add`: float / double result and a finite constant, or decimal or 
integral result and a constant
+ *    (either side)
+ *  - `Multiply`: float / double, decimal or integral result, and the other 
side is a positive numeric
+ *    literal (either side)
  *  - `Divide`: the divisor is a positive numeric literal (column as dividend 
only)
- *  - `DateAdd`, `DateSub`, `DateDiff` (end only), `ShiftLeft`, `ShiftRight`, 
`BitwiseOr`: ANY second
- *    operand is accepted today, constant or not
+ *  - Decimal `Add`, `Multiply` and `Divide` steps are `partial`: an 
overflowing bound is NULL and the
+ *    file is kept
+ *  - `ShiftLeft`: the shift amount is constant
+ *  - `DateAdd`, `DateSub`, `DateDiff` (end only), `ShiftRight`, `BitwiseOr`: 
ANY second operand is
+ *    accepted today, constant or not
  *
  * NOTE: A column-referencing other operand could reverse the ordering (for 
ex, A + A * -2 = -A), and a
  *       non-deterministic one is re-evaluated against the min/max bounds (for 
ex, A + rand())
+ *
+ * NOTE: Integral `Add`, `Multiply` and `ShiftLeft` wrap around on overflow, 
so the max can map below
+ *       the min (for ex, Long.MaxValue * 2 = -2). `Add` and `Multiply` throw 
instead in ANSI mode, while
+ *       `ShiftLeft` wraps around in either mode. Their steps carry a file 
guard that the file's range
+ *       does not overflow (see [[IntegralLimits]]). Float / double results 
round monotonically and
+ *       saturate to infinity instead. Decimal results round HALF_UP, which is 
monotonic, and overflow
+ *       into NULL (or throw in ANSI mode): their steps are `partial`, so an 
overflowing bound is NULL
+ *       and the file is kept. If neither the min nor the max overflows, no 
value in between does (#20460)
  */
 object ConstantOperandRule extends RangeRule {
 
@@ -44,18 +59,47 @@ object ConstantOperandRule extends RangeRule {
     //       which hence must not be matched
     case DateDiff(end, _) => Seq(Step(term, end, Increasing, fileGuard = None, 
partial = false))
 
-    case Add(left, right, _) =>
+    case Add(left, right, _) if hasFloatingPointResult(term) =>
       Seq(
-        when(right.foldable)(Step(term, left, Increasing, fileGuard = None, 
partial = false)),
-        when(left.foldable)(Step(term, right, Increasing, fileGuard = None, 
partial = false))
+        when(isFiniteConstant(right))(Step(term, left, Increasing, fileGuard = 
None, partial = false)),
+        when(isFiniteConstant(left))(Step(term, right, Increasing, fileGuard = 
None, partial = false))
       ).flatten
-    case Multiply(left, right, _) =>
+    case Add(left, right, _) if hasDecimalResult(term) =>
+      Seq(
+        when(right.foldable)(Step(term, left, Increasing, fileGuard = None, 
partial = true)),
+        when(left.foldable)(Step(term, right, Increasing, fileGuard = None, 
partial = true))
+      ).flatten
+    case Add(left, right, _) =>
+      IntegralLimits.of(term).toSeq.flatMap { t =>
+        Seq(
+          integralConstant(right).filter(t.holds).map(c => guardedStep(term, 
left, t.addFits(c))),
+          integralConstant(left).filter(t.holds).map(c => guardedStep(term, 
right, t.addFits(c)))
+        ).flatten
+      }
+
+    case Multiply(left, right, _) if hasFloatingPointResult(term) =>
       Seq(
         when(isPositiveNumericLiteral(right))(Step(term, left, Increasing, 
fileGuard = None, partial = false)),
         when(isPositiveNumericLiteral(left))(Step(term, right, Increasing, 
fileGuard = None, partial = false))
       ).flatten
+    case Multiply(left, right, _) if hasDecimalResult(term) =>
+      Seq(
+        when(isPositiveNumericLiteral(right))(Step(term, left, Increasing, 
fileGuard = None, partial = true)),
+        when(isPositiveNumericLiteral(left))(Step(term, right, Increasing, 
fileGuard = None, partial = true))
+      ).flatten
+    case Multiply(left, right, _) =>
+      IntegralLimits.of(term).toSeq.flatMap { t =>
+        Seq(
+          positiveIntegralLiteral(right).filter(t.holds).map(c => 
guardedStep(term, left, t.multiplyFits(c))),
+          positiveIntegralLiteral(left).filter(t.holds).map(c => 
guardedStep(term, right, t.multiplyFits(c)))
+        ).flatten
+      }
+
+    // NOTE: A decimal quotient can overflow into NULL (for ex, a decimal(38, 
0) column divided by a
+    //       literal has a decimal(38, 6) result, which leaves 32 integer 
digits), so its step is
+    //       `partial` and an overflowing bound keeps the file. Float / double 
quotients saturate instead
     case Divide(dividend, divisor, _) if isPositiveNumericLiteral(divisor) =>
-      Seq(Step(term, dividend, Increasing, fileGuard = None, partial = false))
+      Seq(Step(term, dividend, Increasing, fileGuard = None, partial = 
hasDecimalResult(term)))
 
     // NOTE: BitwiseOr is not monotonic (for ex, 1 < 2 but 1 | 2 = 3 > 2 | 2 = 
2), #20449
     case BitwiseOr(left, right) =>
@@ -63,7 +107,11 @@ object ConstantOperandRule extends RangeRule {
         Step(term, left, Increasing, fileGuard = None, partial = false),
         Step(term, right, Increasing, fileGuard = None, partial = false))
 
-    case ShiftLeft(value, _) => Seq(Step(term, value, Increasing, fileGuard = 
None, partial = false))
+    // NOTE: Spark only shifts int and bigint values, by an int amount
+    case ShiftLeft(value, amount) =>
+      IntegralLimits.of(term).filter(t => t.dataType == IntegerType || 
t.dataType == LongType).toSeq.flatMap { t =>
+        integralConstant(amount).map(n => guardedStep(term, value, 
t.shiftLeftFits(n)))
+      }
     case ShiftRight(value, _) => Seq(Step(term, value, Increasing, fileGuard = 
None, partial = false))
 
     case _ => Nil
@@ -71,6 +119,106 @@ object ConstantOperandRule extends RangeRule {
 
   private def when(guard: Boolean)(step: => Step): Option[Step] = if (guard) 
Some(step) else None
 
+  private def guardedStep(term: Expression, child: Expression, fileGuard: 
TermRange => Expression): Step =
+    Step(term, child, Increasing, fileGuard = Some(fileGuard), partial = false)
+
+  // NOTE: Expression indexes skip the resolution check, and some unresolved 
terms throw on `dataType`
+  private def hasFloatingPointResult(term: Expression): Boolean = 
Try(term.dataType).toOption.exists {
+    case FloatType | DoubleType => true
+    case _ => false
+  }
+
+  // NOTE: Expression indexes skip the resolution check, and some unresolved 
terms throw on `dataType`
+  private def hasDecimalResult(term: Expression): Boolean = 
Try(term.dataType).toOption.exists {
+    case _: DecimalType => true
+    case _ => false
+  }
+
+  // An infinite addend maps the opposite infinity to NaN, which sorts above 
every number (for ex,
+  // -Infinity + Infinity = NaN > 1 + Infinity). Foldable operands evaluate 
without input, which is
+  // how the optimizer folds them into literals
+  private def isFiniteConstant(expr: Expression): Boolean =
+    expr.foldable && Try(expr.eval()).toOption.exists {
+      case f: Float => !f.isInfinite && !f.isNaN
+      case d: Double => !d.isInfinite && !d.isNaN
+      case _ => false
+    }
+
+  // NOTE: Foldable operands evaluate without input, which is how the 
optimizer folds them into literals
+  private def integralConstant(expr: Expression): Option[Long] =
+    if (expr.foldable) Try(expr.eval()).toOption.collect(integralValue) else 
None
+
+  // NOTE: Literal only, as `isPositiveNumericLiteral`
+  private def positiveIntegralLiteral(expr: Expression): Option[Long] = expr 
match {
+    case Literal(value, _) => integralValue.lift(value).filter(_ > 0)
+    case _ => None
+  }
+
+  private val integralValue: PartialFunction[Any, Long] = {
+    case b: Byte => b.toLong
+    case s: Short => s.toLong
+    case i: Int => i.toLong
+    case l: Long => l
+  }
+
+  /**
+   * The limits of an integral result type. Past them, integral arithmetic 
wraps around, except that
+   * `Add` and `Multiply` throw instead in ANSI mode. Each guard holds when no 
value of the file's range
+   * goes past them: the step is increasing, so checking the min and the max 
covers every value in
+   * between. A file that may overflow gets a NULL bound and is kept, and a 
file that holds the guard
+   * never evaluates an overflowing bound, so ANSI `Add` and `Multiply` do not 
throw.
+   */
+  private case class IntegralLimits(dataType: DataType, min: Long, max: Long, 
bits: Int) {
+
+    /**
+     * Whether `c` is a value of this type. Resolved operands always are; 
unresolved ones (expression
+     * indexes) may not be, and their limits would not be either
+     */
+    def holds(c: Long): Boolean = min <= c && c <= max
+
+    /** `x + c` does not overflow: x <= max - c for c >= 0, x >= min - c for c 
< 0. */
+    def addFits(c: Long)(r: TermRange): Expression =
+      if (c >= 0) LessThanOrEqual(r.hi, literal(max - c)) else 
GreaterThanOrEqual(r.lo, literal(min - c))
+
+    /**
+     * `x * c` does not overflow, for c > 0: min / c <= x <= max / c. Long 
division truncates towards
+     * zero, so `min / c` rounds up and `max / c` rounds down, as needed.
+     */
+    def multiplyFits(c: Long)(r: TermRange): Expression = within(r, min / c, 
max / c)
+
+    /**
+     * `x << n` does not overflow: it is x * 2^s, with s the low bits of n (5 
for int, 6 for bigint), as
+     * the JVM shifts. Arithmetic right shifts round towards negative 
infinity, so `min >> s` and
+     * `max >> s` are the exact limits.
+     */
+    def shiftLeftFits(n: Long)(r: TermRange): Expression = {
+      val s = (n & (bits - 1)).toInt
+      within(r, min >> s, max >> s)
+    }
+
+    private def within(r: TermRange, lo: Long, hi: Long): Expression =
+      And(GreaterThanOrEqual(r.lo, literal(lo)), LessThanOrEqual(r.hi, 
literal(hi)))
+
+    // NOTE: For a constant this type [[holds]], every limit above is within 
it, so the narrowing
+    //       conversions below are exact
+    private def literal(v: Long): Literal = dataType match {
+      case ByteType => Literal(v.toByte, ByteType)
+      case ShortType => Literal(v.toShort, ShortType)
+      case IntegerType => Literal(v.toInt, IntegerType)
+      case LongType => Literal(v, LongType)
+    }
+  }
+
+  private object IntegralLimits {
+    // NOTE: Expression indexes skip the resolution check, and some unresolved 
terms throw on `dataType`
+    def of(term: Expression): Option[IntegralLimits] = 
Try(term.dataType).toOption.collect {
+      case ByteType => IntegralLimits(ByteType, Byte.MinValue, Byte.MaxValue, 
8)
+      case ShortType => IntegralLimits(ShortType, Short.MinValue, 
Short.MaxValue, 16)
+      case IntegerType => IntegralLimits(IntegerType, Int.MinValue, 
Int.MaxValue, 32)
+      case LongType => IntegralLimits(LongType, Long.MinValue, Long.MaxValue, 
64)
+    }
+  }
+
   // Negative factors reverse the ordering and zero collapses it. Infinite 
factors can yield NaN
   // (0 * Infinity, Infinity / Infinity), which sorts above every number. 
Non-literal factors are
   // not matched since the optimizer folds constant factors to literals before 
data skipping runs
diff --git 
a/hudi-spark-datasource/hudi-spark/src/test/resources/data-skipping/golden-index-filters.txt
 
b/hudi-spark-datasource/hudi-spark/src/test/resources/data-skipping/golden-index-filters.txt
index 2092fbbf0c78..4ece295497a0 100644
--- 
a/hudi-spark-datasource/hudi-spark/src/test/resources/data-skipping/golden-index-filters.txt
+++ 
b/hudi-spark-datasource/hudi-spark/src/test/resources/data-skipping/golden-index-filters.txt
@@ -172,28 +172,28 @@ cs        (dec = b)       true:boolean
 ei     (dec = b)       true:boolean
 cs     dec IN (0.00:decimal(10,2), b)  true:boolean
 ei     dec IN (0.00:decimal(10,2), b)  true:boolean
-cs     ((a + 1:int) = 0:int)   (((a_minValue + 1:int) <= 0:int) AND 
((a_maxValue + 1:int) >= 0:int))
-cs     (0:int < (a + 1:int))   ((a_maxValue + 1:int) > 0:int)
-cs     ((a + 1:int) >= 0:int)  ((a_maxValue + 1:int) >= 0:int)
-cs     NOT ((a + 1:int) = 0:int)       NOT (((a_minValue + 1:int) = 0:int) AND 
((a_maxValue + 1:int) = 0:int))
-cs     ((a + 1:int) = cast(0:int as int))      (((a_minValue + 1:int) <= 
cast(0:int as int)) AND ((a_maxValue + 1:int) >= cast(0:int as int)))
-cs     (a + 1:int) IN (0:int, null:int)        ((((a_minValue + 1:int) <= 
0:int) AND ((a_maxValue + 1:int) >= 0:int)) OR (((a_minValue + 1:int) <= 
null:int) AND ((a_maxValue + 1:int) >= null:int)))
-cs     NOT (a + 1:int) IN (0:int)      NOT (((a_minValue + 1:int) = 0:int) AND 
((a_maxValue + 1:int) = 0:int))
+cs     ((a + 1:int) = 0:int)   coalesce(((if((a_maxValue <= 2147483646:int), 
(a_minValue + 1:int), null:int) <= 0:int) AND (if((a_maxValue <= 
2147483646:int), (a_maxValue + 1:int), null:int) >= 0:int)), true:boolean)
+cs     (0:int < (a + 1:int))   coalesce((if((a_maxValue <= 2147483646:int), 
(a_maxValue + 1:int), null:int) > 0:int), true:boolean)
+cs     ((a + 1:int) >= 0:int)  coalesce((if((a_maxValue <= 2147483646:int), 
(a_maxValue + 1:int), null:int) >= 0:int), true:boolean)
+cs     NOT ((a + 1:int) = 0:int)       coalesce(NOT ((if((a_maxValue <= 
2147483646:int), (a_minValue + 1:int), null:int) = 0:int) AND (if((a_maxValue 
<= 2147483646:int), (a_maxValue + 1:int), null:int) = 0:int)), true:boolean)
+cs     ((a + 1:int) = cast(0:int as int))      coalesce(((if((a_maxValue <= 
2147483646:int), (a_minValue + 1:int), null:int) <= cast(0:int as int)) AND 
(if((a_maxValue <= 2147483646:int), (a_maxValue + 1:int), null:int) >= 
cast(0:int as int))), true:boolean)
+cs     (a + 1:int) IN (0:int, null:int)        coalesce((((if((a_maxValue <= 
2147483646:int), (a_minValue + 1:int), null:int) <= 0:int) AND (if((a_maxValue 
<= 2147483646:int), (a_maxValue + 1:int), null:int) >= 0:int)) OR 
((if((a_maxValue <= 2147483646:int), (a_minValue + 1:int), null:int) <= 
null:int) AND (if((a_maxValue <= 2147483646:int), (a_maxValue + 1:int), 
null:int) >= null:int))), true:boolean)
+cs     NOT (a + 1:int) IN (0:int)      coalesce(NOT ((if((a_maxValue <= 
2147483646:int), (a_minValue + 1:int), null:int) = 0:int) AND (if((a_maxValue 
<= 2147483646:int), (a_maxValue + 1:int), null:int) = 0:int)), true:boolean)
 cs     startswith((a + 1:int), 'ab')   true:boolean
-ei     startswith((a + 1:int), 'ab')   (((a_minValue + 1:int) <= 'ab') AND 
((a_maxValue + 1:int) >= 'ab'))
+ei     startswith((a + 1:int), 'ab')   coalesce(((if((a_maxValue <= 
2147483646:int), (a_minValue + 1:int), null:int) <= 'ab') AND (if((a_maxValue 
<= 2147483646:int), (a_maxValue + 1:int), null:int) >= 'ab')), true:boolean)
 cs     NOT startswith((a + 1:int), 'ab')       true:boolean
-ei     NOT startswith((a + 1:int), 'ab')       NOT (startswith((a_minValue + 
1:int), 'ab') AND startswith((a_maxValue + 1:int), 'ab'))
-cs     ((1:int + a) = 0:int)   (((1:int + a_minValue) <= 0:int) AND ((1:int + 
a_maxValue) >= 0:int))
-cs     (0:int < (1:int + a))   ((1:int + a_maxValue) > 0:int)
-cs     ((1:int + a) >= 0:int)  ((1:int + a_maxValue) >= 0:int)
-cs     NOT ((1:int + a) = 0:int)       NOT (((1:int + a_minValue) = 0:int) AND 
((1:int + a_maxValue) = 0:int))
-cs     ((1:int + a) = cast(0:int as int))      (((1:int + a_minValue) <= 
cast(0:int as int)) AND ((1:int + a_maxValue) >= cast(0:int as int)))
-cs     (1:int + a) IN (0:int, null:int)        ((((1:int + a_minValue) <= 
0:int) AND ((1:int + a_maxValue) >= 0:int)) OR (((1:int + a_minValue) <= 
null:int) AND ((1:int + a_maxValue) >= null:int)))
-cs     NOT (1:int + a) IN (0:int)      NOT (((1:int + a_minValue) = 0:int) AND 
((1:int + a_maxValue) = 0:int))
+ei     NOT startswith((a + 1:int), 'ab')       coalesce(NOT 
(startswith(if((a_maxValue <= 2147483646:int), (a_minValue + 1:int), null:int), 
'ab') AND startswith(if((a_maxValue <= 2147483646:int), (a_maxValue + 1:int), 
null:int), 'ab')), true:boolean)
+cs     ((1:int + a) = 0:int)   coalesce(((if((a_maxValue <= 2147483646:int), 
(1:int + a_minValue), null:int) <= 0:int) AND (if((a_maxValue <= 
2147483646:int), (1:int + a_maxValue), null:int) >= 0:int)), true:boolean)
+cs     (0:int < (1:int + a))   coalesce((if((a_maxValue <= 2147483646:int), 
(1:int + a_maxValue), null:int) > 0:int), true:boolean)
+cs     ((1:int + a) >= 0:int)  coalesce((if((a_maxValue <= 2147483646:int), 
(1:int + a_maxValue), null:int) >= 0:int), true:boolean)
+cs     NOT ((1:int + a) = 0:int)       coalesce(NOT ((if((a_maxValue <= 
2147483646:int), (1:int + a_minValue), null:int) = 0:int) AND (if((a_maxValue 
<= 2147483646:int), (1:int + a_maxValue), null:int) = 0:int)), true:boolean)
+cs     ((1:int + a) = cast(0:int as int))      coalesce(((if((a_maxValue <= 
2147483646:int), (1:int + a_minValue), null:int) <= cast(0:int as int)) AND 
(if((a_maxValue <= 2147483646:int), (1:int + a_maxValue), null:int) >= 
cast(0:int as int))), true:boolean)
+cs     (1:int + a) IN (0:int, null:int)        coalesce((((if((a_maxValue <= 
2147483646:int), (1:int + a_minValue), null:int) <= 0:int) AND (if((a_maxValue 
<= 2147483646:int), (1:int + a_maxValue), null:int) >= 0:int)) OR 
((if((a_maxValue <= 2147483646:int), (1:int + a_minValue), null:int) <= 
null:int) AND (if((a_maxValue <= 2147483646:int), (1:int + a_maxValue), 
null:int) >= null:int))), true:boolean)
+cs     NOT (1:int + a) IN (0:int)      coalesce(NOT ((if((a_maxValue <= 
2147483646:int), (1:int + a_minValue), null:int) = 0:int) AND (if((a_maxValue 
<= 2147483646:int), (1:int + a_maxValue), null:int) = 0:int)), true:boolean)
 cs     startswith((1:int + a), 'ab')   true:boolean
-ei     startswith((1:int + a), 'ab')   (((1:int + a_minValue) <= 'ab') AND 
((1:int + a_maxValue) >= 'ab'))
+ei     startswith((1:int + a), 'ab')   coalesce(((if((a_maxValue <= 
2147483646:int), (1:int + a_minValue), null:int) <= 'ab') AND (if((a_maxValue 
<= 2147483646:int), (1:int + a_maxValue), null:int) >= 'ab')), true:boolean)
 cs     NOT startswith((1:int + a), 'ab')       true:boolean
-ei     NOT startswith((1:int + a), 'ab')       NOT (startswith((1:int + 
a_minValue), 'ab') AND startswith((1:int + a_maxValue), 'ab'))
+ei     NOT startswith((1:int + a), 'ab')       coalesce(NOT 
(startswith(if((a_maxValue <= 2147483646:int), (1:int + a_minValue), null:int), 
'ab') AND startswith(if((a_maxValue <= 2147483646:int), (1:int + a_maxValue), 
null:int), 'ab')), true:boolean)
 cs     ((a + b) = 0:int)       true:boolean
 cs     (0:int < (a + b))       true:boolean
 cs     ((a + b) >= 0:int)      true:boolean
@@ -228,45 +228,45 @@ ei        startswith((b + 1:int), 'ab')   true:boolean
 cs     NOT startswith((b + 1:int), 'ab')       true:boolean
 ei     NOT startswith((b + 1:int), 'ab')       true:boolean
 cs     ((a + 'x') = 0:int)     true:boolean
-ei     ((a + 'x') = 0:int)     (((a_minValue + 'x') <= 0:int) AND ((a_maxValue 
+ 'x') >= 0:int))
+ei     ((a + 'x') = 0:int)     true:boolean
 cs     (0:int < (a + 'x'))     true:boolean
-ei     (0:int < (a + 'x'))     ((a_maxValue + 'x') > 0:int)
+ei     (0:int < (a + 'x'))     true:boolean
 cs     ((a + 'x') >= 0:int)    true:boolean
-ei     ((a + 'x') >= 0:int)    ((a_maxValue + 'x') >= 0:int)
+ei     ((a + 'x') >= 0:int)    true:boolean
 cs     NOT ((a + 'x') = 0:int) true:boolean
-ei     NOT ((a + 'x') = 0:int) NOT (((a_minValue + 'x') = 0:int) AND 
((a_maxValue + 'x') = 0:int))
+ei     NOT ((a + 'x') = 0:int) true:boolean
 cs     ((a + 'x') = cast(0:int as int))        true:boolean
-ei     ((a + 'x') = cast(0:int as int))        (((a_minValue + 'x') <= 
cast(0:int as int)) AND ((a_maxValue + 'x') >= cast(0:int as int)))
+ei     ((a + 'x') = cast(0:int as int))        true:boolean
 cs     (a + 'x') IN (0:int, null:int)  true:boolean
-ei     (a + 'x') IN (0:int, null:int)  ((((a_minValue + 'x') <= 0:int) AND 
((a_maxValue + 'x') >= 0:int)) OR (((a_minValue + 'x') <= null:int) AND 
((a_maxValue + 'x') >= null:int)))
+ei     (a + 'x') IN (0:int, null:int)  true:boolean
 cs     NOT (a + 'x') IN (0:int)        true:boolean
-ei     NOT (a + 'x') IN (0:int)        NOT (((a_minValue + 'x') = 0:int) AND 
((a_maxValue + 'x') = 0:int))
+ei     NOT (a + 'x') IN (0:int)        true:boolean
 cs     startswith((a + 'x'), 'ab')     true:boolean
-ei     startswith((a + 'x'), 'ab')     (((a_minValue + 'x') <= 'ab') AND 
((a_maxValue + 'x') >= 'ab'))
+ei     startswith((a + 'x'), 'ab')     true:boolean
 cs     NOT startswith((a + 'x'), 'ab') true:boolean
-ei     NOT startswith((a + 'x'), 'ab') NOT (startswith((a_minValue + 'x'), 
'ab') AND startswith((a_maxValue + 'x'), 'ab'))
-cs     ((a * 2:int) = 0:int)   (((a_minValue * 2:int) <= 0:int) AND 
((a_maxValue * 2:int) >= 0:int))
-cs     (0:int < (a * 2:int))   ((a_maxValue * 2:int) > 0:int)
-cs     ((a * 2:int) >= 0:int)  ((a_maxValue * 2:int) >= 0:int)
-cs     NOT ((a * 2:int) = 0:int)       NOT (((a_minValue * 2:int) = 0:int) AND 
((a_maxValue * 2:int) = 0:int))
-cs     ((a * 2:int) = cast(0:int as int))      (((a_minValue * 2:int) <= 
cast(0:int as int)) AND ((a_maxValue * 2:int) >= cast(0:int as int)))
-cs     (a * 2:int) IN (0:int, null:int)        ((((a_minValue * 2:int) <= 
0:int) AND ((a_maxValue * 2:int) >= 0:int)) OR (((a_minValue * 2:int) <= 
null:int) AND ((a_maxValue * 2:int) >= null:int)))
-cs     NOT (a * 2:int) IN (0:int)      NOT (((a_minValue * 2:int) = 0:int) AND 
((a_maxValue * 2:int) = 0:int))
+ei     NOT startswith((a + 'x'), 'ab') true:boolean
+cs     ((a * 2:int) = 0:int)   coalesce(((if(((a_minValue >= -1073741824:int) 
AND (a_maxValue <= 1073741823:int)), (a_minValue * 2:int), null:int) <= 0:int) 
AND (if(((a_minValue >= -1073741824:int) AND (a_maxValue <= 1073741823:int)), 
(a_maxValue * 2:int), null:int) >= 0:int)), true:boolean)
+cs     (0:int < (a * 2:int))   coalesce((if(((a_minValue >= -1073741824:int) 
AND (a_maxValue <= 1073741823:int)), (a_maxValue * 2:int), null:int) > 0:int), 
true:boolean)
+cs     ((a * 2:int) >= 0:int)  coalesce((if(((a_minValue >= -1073741824:int) 
AND (a_maxValue <= 1073741823:int)), (a_maxValue * 2:int), null:int) >= 0:int), 
true:boolean)
+cs     NOT ((a * 2:int) = 0:int)       coalesce(NOT ((if(((a_minValue >= 
-1073741824:int) AND (a_maxValue <= 1073741823:int)), (a_minValue * 2:int), 
null:int) = 0:int) AND (if(((a_minValue >= -1073741824:int) AND (a_maxValue <= 
1073741823:int)), (a_maxValue * 2:int), null:int) = 0:int)), true:boolean)
+cs     ((a * 2:int) = cast(0:int as int))      coalesce(((if(((a_minValue >= 
-1073741824:int) AND (a_maxValue <= 1073741823:int)), (a_minValue * 2:int), 
null:int) <= cast(0:int as int)) AND (if(((a_minValue >= -1073741824:int) AND 
(a_maxValue <= 1073741823:int)), (a_maxValue * 2:int), null:int) >= cast(0:int 
as int))), true:boolean)
+cs     (a * 2:int) IN (0:int, null:int)        coalesce((((if(((a_minValue >= 
-1073741824:int) AND (a_maxValue <= 1073741823:int)), (a_minValue * 2:int), 
null:int) <= 0:int) AND (if(((a_minValue >= -1073741824:int) AND (a_maxValue <= 
1073741823:int)), (a_maxValue * 2:int), null:int) >= 0:int)) OR 
((if(((a_minValue >= -1073741824:int) AND (a_maxValue <= 1073741823:int)), 
(a_minValue * 2:int), null:int) <= null:int) AND (if(((a_minValue >= 
-1073741824:int) AND (a_maxValue <= 1073741823:int)), (a_maxV [...]
+cs     NOT (a * 2:int) IN (0:int)      coalesce(NOT ((if(((a_minValue >= 
-1073741824:int) AND (a_maxValue <= 1073741823:int)), (a_minValue * 2:int), 
null:int) = 0:int) AND (if(((a_minValue >= -1073741824:int) AND (a_maxValue <= 
1073741823:int)), (a_maxValue * 2:int), null:int) = 0:int)), true:boolean)
 cs     startswith((a * 2:int), 'ab')   true:boolean
-ei     startswith((a * 2:int), 'ab')   (((a_minValue * 2:int) <= 'ab') AND 
((a_maxValue * 2:int) >= 'ab'))
+ei     startswith((a * 2:int), 'ab')   coalesce(((if(((a_minValue >= 
-1073741824:int) AND (a_maxValue <= 1073741823:int)), (a_minValue * 2:int), 
null:int) <= 'ab') AND (if(((a_minValue >= -1073741824:int) AND (a_maxValue <= 
1073741823:int)), (a_maxValue * 2:int), null:int) >= 'ab')), true:boolean)
 cs     NOT startswith((a * 2:int), 'ab')       true:boolean
-ei     NOT startswith((a * 2:int), 'ab')       NOT (startswith((a_minValue * 
2:int), 'ab') AND startswith((a_maxValue * 2:int), 'ab'))
-cs     ((2:int * a) = 0:int)   (((2:int * a_minValue) <= 0:int) AND ((2:int * 
a_maxValue) >= 0:int))
-cs     (0:int < (2:int * a))   ((2:int * a_maxValue) > 0:int)
-cs     ((2:int * a) >= 0:int)  ((2:int * a_maxValue) >= 0:int)
-cs     NOT ((2:int * a) = 0:int)       NOT (((2:int * a_minValue) = 0:int) AND 
((2:int * a_maxValue) = 0:int))
-cs     ((2:int * a) = cast(0:int as int))      (((2:int * a_minValue) <= 
cast(0:int as int)) AND ((2:int * a_maxValue) >= cast(0:int as int)))
-cs     (2:int * a) IN (0:int, null:int)        ((((2:int * a_minValue) <= 
0:int) AND ((2:int * a_maxValue) >= 0:int)) OR (((2:int * a_minValue) <= 
null:int) AND ((2:int * a_maxValue) >= null:int)))
-cs     NOT (2:int * a) IN (0:int)      NOT (((2:int * a_minValue) = 0:int) AND 
((2:int * a_maxValue) = 0:int))
+ei     NOT startswith((a * 2:int), 'ab')       coalesce(NOT 
(startswith(if(((a_minValue >= -1073741824:int) AND (a_maxValue <= 
1073741823:int)), (a_minValue * 2:int), null:int), 'ab') AND 
startswith(if(((a_minValue >= -1073741824:int) AND (a_maxValue <= 
1073741823:int)), (a_maxValue * 2:int), null:int), 'ab')), true:boolean)
+cs     ((2:int * a) = 0:int)   coalesce(((if(((a_minValue >= -1073741824:int) 
AND (a_maxValue <= 1073741823:int)), (2:int * a_minValue), null:int) <= 0:int) 
AND (if(((a_minValue >= -1073741824:int) AND (a_maxValue <= 1073741823:int)), 
(2:int * a_maxValue), null:int) >= 0:int)), true:boolean)
+cs     (0:int < (2:int * a))   coalesce((if(((a_minValue >= -1073741824:int) 
AND (a_maxValue <= 1073741823:int)), (2:int * a_maxValue), null:int) > 0:int), 
true:boolean)
+cs     ((2:int * a) >= 0:int)  coalesce((if(((a_minValue >= -1073741824:int) 
AND (a_maxValue <= 1073741823:int)), (2:int * a_maxValue), null:int) >= 0:int), 
true:boolean)
+cs     NOT ((2:int * a) = 0:int)       coalesce(NOT ((if(((a_minValue >= 
-1073741824:int) AND (a_maxValue <= 1073741823:int)), (2:int * a_minValue), 
null:int) = 0:int) AND (if(((a_minValue >= -1073741824:int) AND (a_maxValue <= 
1073741823:int)), (2:int * a_maxValue), null:int) = 0:int)), true:boolean)
+cs     ((2:int * a) = cast(0:int as int))      coalesce(((if(((a_minValue >= 
-1073741824:int) AND (a_maxValue <= 1073741823:int)), (2:int * a_minValue), 
null:int) <= cast(0:int as int)) AND (if(((a_minValue >= -1073741824:int) AND 
(a_maxValue <= 1073741823:int)), (2:int * a_maxValue), null:int) >= cast(0:int 
as int))), true:boolean)
+cs     (2:int * a) IN (0:int, null:int)        coalesce((((if(((a_minValue >= 
-1073741824:int) AND (a_maxValue <= 1073741823:int)), (2:int * a_minValue), 
null:int) <= 0:int) AND (if(((a_minValue >= -1073741824:int) AND (a_maxValue <= 
1073741823:int)), (2:int * a_maxValue), null:int) >= 0:int)) OR 
((if(((a_minValue >= -1073741824:int) AND (a_maxValue <= 1073741823:int)), 
(2:int * a_minValue), null:int) <= null:int) AND (if(((a_minValue >= 
-1073741824:int) AND (a_maxValue <= 1073741823:int)), (2:int  [...]
+cs     NOT (2:int * a) IN (0:int)      coalesce(NOT ((if(((a_minValue >= 
-1073741824:int) AND (a_maxValue <= 1073741823:int)), (2:int * a_minValue), 
null:int) = 0:int) AND (if(((a_minValue >= -1073741824:int) AND (a_maxValue <= 
1073741823:int)), (2:int * a_maxValue), null:int) = 0:int)), true:boolean)
 cs     startswith((2:int * a), 'ab')   true:boolean
-ei     startswith((2:int * a), 'ab')   (((2:int * a_minValue) <= 'ab') AND 
((2:int * a_maxValue) >= 'ab'))
+ei     startswith((2:int * a), 'ab')   coalesce(((if(((a_minValue >= 
-1073741824:int) AND (a_maxValue <= 1073741823:int)), (2:int * a_minValue), 
null:int) <= 'ab') AND (if(((a_minValue >= -1073741824:int) AND (a_maxValue <= 
1073741823:int)), (2:int * a_maxValue), null:int) >= 'ab')), true:boolean)
 cs     NOT startswith((2:int * a), 'ab')       true:boolean
-ei     NOT startswith((2:int * a), 'ab')       NOT (startswith((2:int * 
a_minValue), 'ab') AND startswith((2:int * a_maxValue), 'ab'))
+ei     NOT startswith((2:int * a), 'ab')       coalesce(NOT 
(startswith(if(((a_minValue >= -1073741824:int) AND (a_maxValue <= 
1073741823:int)), (2:int * a_minValue), null:int), 'ab') AND 
startswith(if(((a_minValue >= -1073741824:int) AND (a_maxValue <= 
1073741823:int)), (2:int * a_maxValue), null:int), 'ab')), true:boolean)
 cs     ((a * -2:int) = 0:int)  true:boolean
 cs     (0:int < (a * -2:int))  true:boolean
 cs     ((a * -2:int) >= 0:int) true:boolean
@@ -311,17 +311,17 @@ cs        startswith((x * Infinity:double), 'ab') 
true:boolean
 ei     startswith((x * Infinity:double), 'ab') true:boolean
 cs     NOT startswith((x * Infinity:double), 'ab')     true:boolean
 ei     NOT startswith((x * Infinity:double), 'ab')     true:boolean
-cs     ((dec * 1.5:decimal(2,1)) = 0.000:decimal(13,3))        (((dec_minValue 
* 1.5:decimal(2,1)) <= 0.000:decimal(13,3)) AND ((dec_maxValue * 
1.5:decimal(2,1)) >= 0.000:decimal(13,3)))
-cs     (0.000:decimal(13,3) < (dec * 1.5:decimal(2,1)))        ((dec_maxValue 
* 1.5:decimal(2,1)) > 0.000:decimal(13,3))
-cs     ((dec * 1.5:decimal(2,1)) >= 0.000:decimal(13,3))       ((dec_maxValue 
* 1.5:decimal(2,1)) >= 0.000:decimal(13,3))
-cs     NOT ((dec * 1.5:decimal(2,1)) = 0.000:decimal(13,3))    NOT 
(((dec_minValue * 1.5:decimal(2,1)) = 0.000:decimal(13,3)) AND ((dec_maxValue * 
1.5:decimal(2,1)) = 0.000:decimal(13,3)))
-cs     ((dec * 1.5:decimal(2,1)) = cast(0.000:decimal(13,3) as decimal(13,3))) 
(((dec_minValue * 1.5:decimal(2,1)) <= cast(0.000:decimal(13,3) as 
decimal(13,3))) AND ((dec_maxValue * 1.5:decimal(2,1)) >= 
cast(0.000:decimal(13,3) as decimal(13,3))))
-cs     (dec * 1.5:decimal(2,1)) IN (0.000:decimal(13,3), null:decimal(13,3))   
((((dec_minValue * 1.5:decimal(2,1)) <= 0.000:decimal(13,3)) AND ((dec_maxValue 
* 1.5:decimal(2,1)) >= 0.000:decimal(13,3))) OR (((dec_minValue * 
1.5:decimal(2,1)) <= null:decimal(13,3)) AND ((dec_maxValue * 1.5:decimal(2,1)) 
>= null:decimal(13,3))))
-cs     NOT (dec * 1.5:decimal(2,1)) IN (0.000:decimal(13,3))   NOT 
(((dec_minValue * 1.5:decimal(2,1)) = 0.000:decimal(13,3)) AND ((dec_maxValue * 
1.5:decimal(2,1)) = 0.000:decimal(13,3)))
+cs     ((dec * 1.5:decimal(2,1)) = 0.000:decimal(13,3))        
coalesce(((tryeval((dec_minValue * 1.5:decimal(2,1))) <= 0.000:decimal(13,3)) 
AND (tryeval((dec_maxValue * 1.5:decimal(2,1))) >= 0.000:decimal(13,3))), 
true:boolean)
+cs     (0.000:decimal(13,3) < (dec * 1.5:decimal(2,1)))        
coalesce((tryeval((dec_maxValue * 1.5:decimal(2,1))) > 0.000:decimal(13,3)), 
true:boolean)
+cs     ((dec * 1.5:decimal(2,1)) >= 0.000:decimal(13,3))       
coalesce((tryeval((dec_maxValue * 1.5:decimal(2,1))) >= 0.000:decimal(13,3)), 
true:boolean)
+cs     NOT ((dec * 1.5:decimal(2,1)) = 0.000:decimal(13,3))    coalesce(NOT 
((tryeval((dec_minValue * 1.5:decimal(2,1))) = 0.000:decimal(13,3)) AND 
(tryeval((dec_maxValue * 1.5:decimal(2,1))) = 0.000:decimal(13,3))), 
true:boolean)
+cs     ((dec * 1.5:decimal(2,1)) = cast(0.000:decimal(13,3) as decimal(13,3))) 
coalesce(((tryeval((dec_minValue * 1.5:decimal(2,1))) <= 
cast(0.000:decimal(13,3) as decimal(13,3))) AND (tryeval((dec_maxValue * 
1.5:decimal(2,1))) >= cast(0.000:decimal(13,3) as decimal(13,3)))), 
true:boolean)
+cs     (dec * 1.5:decimal(2,1)) IN (0.000:decimal(13,3), null:decimal(13,3))   
coalesce((((tryeval((dec_minValue * 1.5:decimal(2,1))) <= 0.000:decimal(13,3)) 
AND (tryeval((dec_maxValue * 1.5:decimal(2,1))) >= 0.000:decimal(13,3))) OR 
((tryeval((dec_minValue * 1.5:decimal(2,1))) <= null:decimal(13,3)) AND 
(tryeval((dec_maxValue * 1.5:decimal(2,1))) >= null:decimal(13,3)))), 
true:boolean)
+cs     NOT (dec * 1.5:decimal(2,1)) IN (0.000:decimal(13,3))   coalesce(NOT 
((tryeval((dec_minValue * 1.5:decimal(2,1))) = 0.000:decimal(13,3)) AND 
(tryeval((dec_maxValue * 1.5:decimal(2,1))) = 0.000:decimal(13,3))), 
true:boolean)
 cs     startswith((dec * 1.5:decimal(2,1)), 'ab')      true:boolean
-ei     startswith((dec * 1.5:decimal(2,1)), 'ab')      (((dec_minValue * 
1.5:decimal(2,1)) <= 'ab') AND ((dec_maxValue * 1.5:decimal(2,1)) >= 'ab'))
+ei     startswith((dec * 1.5:decimal(2,1)), 'ab')      
coalesce(((tryeval((dec_minValue * 1.5:decimal(2,1))) <= 'ab') AND 
(tryeval((dec_maxValue * 1.5:decimal(2,1))) >= 'ab')), true:boolean)
 cs     NOT startswith((dec * 1.5:decimal(2,1)), 'ab')  true:boolean
-ei     NOT startswith((dec * 1.5:decimal(2,1)), 'ab')  NOT 
(startswith((dec_minValue * 1.5:decimal(2,1)), 'ab') AND 
startswith((dec_maxValue * 1.5:decimal(2,1)), 'ab'))
+ei     NOT startswith((dec * 1.5:decimal(2,1)), 'ab')  coalesce(NOT 
(startswith(tryeval((dec_minValue * 1.5:decimal(2,1))), 'ab') AND 
startswith(tryeval((dec_maxValue * 1.5:decimal(2,1))), 'ab')), true:boolean)
 cs     ((x / 2.0:double) = 0.0:double) (((x_minValue / 2.0:double) <= 
0.0:double) AND ((x_maxValue / 2.0:double) >= 0.0:double))
 cs     (0.0:double < (x / 2.0:double)) ((x_maxValue / 2.0:double) > 0.0:double)
 cs     ((x / 2.0:double) >= 0.0:double)        ((x_maxValue / 2.0:double) >= 
0.0:double)
@@ -410,17 +410,17 @@ cs        startswith((a | a), 'ab')       true:boolean
 ei     startswith((a | a), 'ab')       (((a_minValue | a_minValue) <= 'ab') 
AND ((a_maxValue | a_maxValue) >= 'ab'))
 cs     NOT startswith((a | a), 'ab')   true:boolean
 ei     NOT startswith((a | a), 'ab')   NOT (startswith((a_minValue | 
a_minValue), 'ab') AND startswith((a_maxValue | a_maxValue), 'ab'))
-cs     (shiftleft(a, 1:int) = 0:int)   ((shiftleft(a_minValue, 1:int) <= 
0:int) AND (shiftleft(a_maxValue, 1:int) >= 0:int))
-cs     (0:int < shiftleft(a, 1:int))   (shiftleft(a_maxValue, 1:int) > 0:int)
-cs     (shiftleft(a, 1:int) >= 0:int)  (shiftleft(a_maxValue, 1:int) >= 0:int)
-cs     NOT (shiftleft(a, 1:int) = 0:int)       NOT ((shiftleft(a_minValue, 
1:int) = 0:int) AND (shiftleft(a_maxValue, 1:int) = 0:int))
-cs     (shiftleft(a, 1:int) = cast(0:int as int))      ((shiftleft(a_minValue, 
1:int) <= cast(0:int as int)) AND (shiftleft(a_maxValue, 1:int) >= cast(0:int 
as int)))
-cs     shiftleft(a, 1:int) IN (0:int, null:int)        
(((shiftleft(a_minValue, 1:int) <= 0:int) AND (shiftleft(a_maxValue, 1:int) >= 
0:int)) OR ((shiftleft(a_minValue, 1:int) <= null:int) AND 
(shiftleft(a_maxValue, 1:int) >= null:int)))
-cs     NOT shiftleft(a, 1:int) IN (0:int)      NOT ((shiftleft(a_minValue, 
1:int) = 0:int) AND (shiftleft(a_maxValue, 1:int) = 0:int))
+cs     (shiftleft(a, 1:int) = 0:int)   coalesce(((if(((a_minValue >= 
-1073741824:int) AND (a_maxValue <= 1073741823:int)), shiftleft(a_minValue, 
1:int), null:int) <= 0:int) AND (if(((a_minValue >= -1073741824:int) AND 
(a_maxValue <= 1073741823:int)), shiftleft(a_maxValue, 1:int), null:int) >= 
0:int)), true:boolean)
+cs     (0:int < shiftleft(a, 1:int))   coalesce((if(((a_minValue >= 
-1073741824:int) AND (a_maxValue <= 1073741823:int)), shiftleft(a_maxValue, 
1:int), null:int) > 0:int), true:boolean)
+cs     (shiftleft(a, 1:int) >= 0:int)  coalesce((if(((a_minValue >= 
-1073741824:int) AND (a_maxValue <= 1073741823:int)), shiftleft(a_maxValue, 
1:int), null:int) >= 0:int), true:boolean)
+cs     NOT (shiftleft(a, 1:int) = 0:int)       coalesce(NOT ((if(((a_minValue 
>= -1073741824:int) AND (a_maxValue <= 1073741823:int)), shiftleft(a_minValue, 
1:int), null:int) = 0:int) AND (if(((a_minValue >= -1073741824:int) AND 
(a_maxValue <= 1073741823:int)), shiftleft(a_maxValue, 1:int), null:int) = 
0:int)), true:boolean)
+cs     (shiftleft(a, 1:int) = cast(0:int as int))      
coalesce(((if(((a_minValue >= -1073741824:int) AND (a_maxValue <= 
1073741823:int)), shiftleft(a_minValue, 1:int), null:int) <= cast(0:int as 
int)) AND (if(((a_minValue >= -1073741824:int) AND (a_maxValue <= 
1073741823:int)), shiftleft(a_maxValue, 1:int), null:int) >= cast(0:int as 
int))), true:boolean)
+cs     shiftleft(a, 1:int) IN (0:int, null:int)        
coalesce((((if(((a_minValue >= -1073741824:int) AND (a_maxValue <= 
1073741823:int)), shiftleft(a_minValue, 1:int), null:int) <= 0:int) AND 
(if(((a_minValue >= -1073741824:int) AND (a_maxValue <= 1073741823:int)), 
shiftleft(a_maxValue, 1:int), null:int) >= 0:int)) OR ((if(((a_minValue >= 
-1073741824:int) AND (a_maxValue <= 1073741823:int)), shiftleft(a_minValue, 
1:int), null:int) <= null:int) AND (if(((a_minValue >= -1073741824:int) AND 
(a_maxVa [...]
+cs     NOT shiftleft(a, 1:int) IN (0:int)      coalesce(NOT ((if(((a_minValue 
>= -1073741824:int) AND (a_maxValue <= 1073741823:int)), shiftleft(a_minValue, 
1:int), null:int) = 0:int) AND (if(((a_minValue >= -1073741824:int) AND 
(a_maxValue <= 1073741823:int)), shiftleft(a_maxValue, 1:int), null:int) = 
0:int)), true:boolean)
 cs     startswith(shiftleft(a, 1:int), 'ab')   true:boolean
-ei     startswith(shiftleft(a, 1:int), 'ab')   ((shiftleft(a_minValue, 1:int) 
<= 'ab') AND (shiftleft(a_maxValue, 1:int) >= 'ab'))
+ei     startswith(shiftleft(a, 1:int), 'ab')   coalesce(((if(((a_minValue >= 
-1073741824:int) AND (a_maxValue <= 1073741823:int)), shiftleft(a_minValue, 
1:int), null:int) <= 'ab') AND (if(((a_minValue >= -1073741824:int) AND 
(a_maxValue <= 1073741823:int)), shiftleft(a_maxValue, 1:int), null:int) >= 
'ab')), true:boolean)
 cs     NOT startswith(shiftleft(a, 1:int), 'ab')       true:boolean
-ei     NOT startswith(shiftleft(a, 1:int), 'ab')       NOT 
(startswith(shiftleft(a_minValue, 1:int), 'ab') AND 
startswith(shiftleft(a_maxValue, 1:int), 'ab'))
+ei     NOT startswith(shiftleft(a, 1:int), 'ab')       coalesce(NOT 
(startswith(if(((a_minValue >= -1073741824:int) AND (a_maxValue <= 
1073741823:int)), shiftleft(a_minValue, 1:int), null:int), 'ab') AND 
startswith(if(((a_minValue >= -1073741824:int) AND (a_maxValue <= 
1073741823:int)), shiftleft(a_maxValue, 1:int), null:int), 'ab')), true:boolean)
 cs     (shiftright(a, 2:int) = 0:int)  ((shiftright(a_minValue, 2:int) <= 
0:int) AND (shiftright(a_maxValue, 2:int) >= 0:int))
 cs     (0:int < shiftright(a, 2:int))  (shiftright(a_maxValue, 2:int) > 0:int)
 cs     (shiftright(a, 2:int) >= 0:int) (shiftright(a_maxValue, 2:int) >= 0:int)
@@ -432,17 +432,17 @@ cs        startswith(shiftright(a, 2:int), 'ab')  
true:boolean
 ei     startswith(shiftright(a, 2:int), 'ab')  ((shiftright(a_minValue, 2:int) 
<= 'ab') AND (shiftright(a_maxValue, 2:int) >= 'ab'))
 cs     NOT startswith(shiftright(a, 2:int), 'ab')      true:boolean
 ei     NOT startswith(shiftright(a, 2:int), 'ab')      NOT 
(startswith(shiftright(a_minValue, 2:int), 'ab') AND 
startswith(shiftright(a_maxValue, 2:int), 'ab'))
-cs     (shiftleft(a, a) = 0:int)       ((shiftleft(a_minValue, a_minValue) <= 
0:int) AND (shiftleft(a_maxValue, a_maxValue) >= 0:int))
-cs     (0:int < shiftleft(a, a))       (shiftleft(a_maxValue, a_maxValue) > 
0:int)
-cs     (shiftleft(a, a) >= 0:int)      (shiftleft(a_maxValue, a_maxValue) >= 
0:int)
-cs     NOT (shiftleft(a, a) = 0:int)   NOT ((shiftleft(a_minValue, a_minValue) 
= 0:int) AND (shiftleft(a_maxValue, a_maxValue) = 0:int))
-cs     (shiftleft(a, a) = cast(0:int as int))  ((shiftleft(a_minValue, 
a_minValue) <= cast(0:int as int)) AND (shiftleft(a_maxValue, a_maxValue) >= 
cast(0:int as int)))
-cs     shiftleft(a, a) IN (0:int, null:int)    (((shiftleft(a_minValue, 
a_minValue) <= 0:int) AND (shiftleft(a_maxValue, a_maxValue) >= 0:int)) OR 
((shiftleft(a_minValue, a_minValue) <= null:int) AND (shiftleft(a_maxValue, 
a_maxValue) >= null:int)))
-cs     NOT shiftleft(a, a) IN (0:int)  NOT ((shiftleft(a_minValue, a_minValue) 
= 0:int) AND (shiftleft(a_maxValue, a_maxValue) = 0:int))
+cs     (shiftleft(a, a) = 0:int)       true:boolean
+cs     (0:int < shiftleft(a, a))       true:boolean
+cs     (shiftleft(a, a) >= 0:int)      true:boolean
+cs     NOT (shiftleft(a, a) = 0:int)   true:boolean
+cs     (shiftleft(a, a) = cast(0:int as int))  true:boolean
+cs     shiftleft(a, a) IN (0:int, null:int)    true:boolean
+cs     NOT shiftleft(a, a) IN (0:int)  true:boolean
 cs     startswith(shiftleft(a, a), 'ab')       true:boolean
-ei     startswith(shiftleft(a, a), 'ab')       ((shiftleft(a_minValue, 
a_minValue) <= 'ab') AND (shiftleft(a_maxValue, a_maxValue) >= 'ab'))
+ei     startswith(shiftleft(a, a), 'ab')       true:boolean
 cs     NOT startswith(shiftleft(a, a), 'ab')   true:boolean
-ei     NOT startswith(shiftleft(a, a), 'ab')   NOT 
(startswith(shiftleft(a_minValue, a_minValue), 'ab') AND 
startswith(shiftleft(a_maxValue, a_maxValue), 'ab'))
+ei     NOT startswith(shiftleft(a, a), 'ab')   true:boolean
 cs     (shiftright(8:int, a) = 0:int)  true:boolean
 cs     (0:int < shiftright(8:int, a))  true:boolean
 cs     (shiftright(8:int, a) >= 0:int) true:boolean
@@ -593,17 +593,17 @@ cs        cast(a as string) IN ('', null:string)  
true:boolean
 cs     NOT cast(a as string) IN ('')   true:boolean
 cs     startswith(cast(a as string), 'ab')     true:boolean
 cs     NOT startswith(cast(a as string), 'ab') true:boolean
-cs     (cast((a + 1:int) as bigint) = 0:bigint)        ((cast((a_minValue + 
1:int) as bigint) <= 0:bigint) AND (cast((a_maxValue + 1:int) as bigint) >= 
0:bigint))
-cs     (0:bigint < cast((a + 1:int) as bigint))        (cast((a_maxValue + 
1:int) as bigint) > 0:bigint)
-cs     (cast((a + 1:int) as bigint) >= 0:bigint)       (cast((a_maxValue + 
1:int) as bigint) >= 0:bigint)
-cs     NOT (cast((a + 1:int) as bigint) = 0:bigint)    NOT ((cast((a_minValue 
+ 1:int) as bigint) = 0:bigint) AND (cast((a_maxValue + 1:int) as bigint) = 
0:bigint))
-cs     (cast((a + 1:int) as bigint) = cast(0:bigint as bigint))        
((cast((a_minValue + 1:int) as bigint) <= cast(0:bigint as bigint)) AND 
(cast((a_maxValue + 1:int) as bigint) >= cast(0:bigint as bigint)))
-cs     cast((a + 1:int) as bigint) IN (0:bigint, null:bigint)  
(((cast((a_minValue + 1:int) as bigint) <= 0:bigint) AND (cast((a_maxValue + 
1:int) as bigint) >= 0:bigint)) OR ((cast((a_minValue + 1:int) as bigint) <= 
null:bigint) AND (cast((a_maxValue + 1:int) as bigint) >= null:bigint)))
-cs     NOT cast((a + 1:int) as bigint) IN (0:bigint)   NOT ((cast((a_minValue 
+ 1:int) as bigint) = 0:bigint) AND (cast((a_maxValue + 1:int) as bigint) = 
0:bigint))
+cs     (cast((a + 1:int) as bigint) = 0:bigint)        
coalesce(((cast(if((a_maxValue <= 2147483646:int), (a_minValue + 1:int), 
null:int) as bigint) <= 0:bigint) AND (cast(if((a_maxValue <= 2147483646:int), 
(a_maxValue + 1:int), null:int) as bigint) >= 0:bigint)), true:boolean)
+cs     (0:bigint < cast((a + 1:int) as bigint))        
coalesce((cast(if((a_maxValue <= 2147483646:int), (a_maxValue + 1:int), 
null:int) as bigint) > 0:bigint), true:boolean)
+cs     (cast((a + 1:int) as bigint) >= 0:bigint)       
coalesce((cast(if((a_maxValue <= 2147483646:int), (a_maxValue + 1:int), 
null:int) as bigint) >= 0:bigint), true:boolean)
+cs     NOT (cast((a + 1:int) as bigint) = 0:bigint)    coalesce(NOT 
((cast(if((a_maxValue <= 2147483646:int), (a_minValue + 1:int), null:int) as 
bigint) = 0:bigint) AND (cast(if((a_maxValue <= 2147483646:int), (a_maxValue + 
1:int), null:int) as bigint) = 0:bigint)), true:boolean)
+cs     (cast((a + 1:int) as bigint) = cast(0:bigint as bigint))        
coalesce(((cast(if((a_maxValue <= 2147483646:int), (a_minValue + 1:int), 
null:int) as bigint) <= cast(0:bigint as bigint)) AND (cast(if((a_maxValue <= 
2147483646:int), (a_maxValue + 1:int), null:int) as bigint) >= cast(0:bigint as 
bigint))), true:boolean)
+cs     cast((a + 1:int) as bigint) IN (0:bigint, null:bigint)  
coalesce((((cast(if((a_maxValue <= 2147483646:int), (a_minValue + 1:int), 
null:int) as bigint) <= 0:bigint) AND (cast(if((a_maxValue <= 2147483646:int), 
(a_maxValue + 1:int), null:int) as bigint) >= 0:bigint)) OR 
((cast(if((a_maxValue <= 2147483646:int), (a_minValue + 1:int), null:int) as 
bigint) <= null:bigint) AND (cast(if((a_maxValue <= 2147483646:int), 
(a_maxValue + 1:int), null:int) as bigint) >= null:bigint))), true:boolean)
+cs     NOT cast((a + 1:int) as bigint) IN (0:bigint)   coalesce(NOT 
((cast(if((a_maxValue <= 2147483646:int), (a_minValue + 1:int), null:int) as 
bigint) = 0:bigint) AND (cast(if((a_maxValue <= 2147483646:int), (a_maxValue + 
1:int), null:int) as bigint) = 0:bigint)), true:boolean)
 cs     startswith(cast((a + 1:int) as bigint), 'ab')   true:boolean
-ei     startswith(cast((a + 1:int) as bigint), 'ab')   ((cast((a_minValue + 
1:int) as bigint) <= 'ab') AND (cast((a_maxValue + 1:int) as bigint) >= 'ab'))
+ei     startswith(cast((a + 1:int) as bigint), 'ab')   
coalesce(((cast(if((a_maxValue <= 2147483646:int), (a_minValue + 1:int), 
null:int) as bigint) <= 'ab') AND (cast(if((a_maxValue <= 2147483646:int), 
(a_maxValue + 1:int), null:int) as bigint) >= 'ab')), true:boolean)
 cs     NOT startswith(cast((a + 1:int) as bigint), 'ab')       true:boolean
-ei     NOT startswith(cast((a + 1:int) as bigint), 'ab')       NOT 
(startswith(cast((a_minValue + 1:int) as bigint), 'ab') AND 
startswith(cast((a_maxValue + 1:int) as bigint), 'ab'))
+ei     NOT startswith(cast((a + 1:int) as bigint), 'ab')       coalesce(NOT 
(startswith(cast(if((a_maxValue <= 2147483646:int), (a_minValue + 1:int), 
null:int) as bigint), 'ab') AND startswith(cast(if((a_maxValue <= 
2147483646:int), (a_maxValue + 1:int), null:int) as bigint), 'ab')), 
true:boolean)
 cs     (cast(cast(a as bigint) as double) = 0.0:double)        
((cast(cast(a_minValue as bigint) as double) <= 0.0:double) AND 
(cast(cast(a_maxValue as bigint) as double) >= 0.0:double))
 cs     (0.0:double < cast(cast(a as bigint) as double))        
(cast(cast(a_maxValue as bigint) as double) > 0.0:double)
 cs     (cast(cast(a as bigint) as double) >= 0.0:double)       
(cast(cast(a_maxValue as bigint) as double) >= 0.0:double)
@@ -682,23 +682,23 @@ ei        startswith(cast(ts as int), 'ab')       
true:boolean
 cs     NOT startswith(cast(ts as int), 'ab')   true:boolean
 ei     NOT startswith(cast(ts as int), 'ab')   true:boolean
 cs     (cast((a + 'x') as bigint) = 0:bigint)  true:boolean
-ei     (cast((a + 'x') as bigint) = 0:bigint)  ((cast((a_minValue + 'x') as 
bigint) <= 0:bigint) AND (cast((a_maxValue + 'x') as bigint) >= 0:bigint))
+ei     (cast((a + 'x') as bigint) = 0:bigint)  true:boolean
 cs     (0:bigint < cast((a + 'x') as bigint))  true:boolean
-ei     (0:bigint < cast((a + 'x') as bigint))  (cast((a_maxValue + 'x') as 
bigint) > 0:bigint)
+ei     (0:bigint < cast((a + 'x') as bigint))  true:boolean
 cs     (cast((a + 'x') as bigint) >= 0:bigint) true:boolean
-ei     (cast((a + 'x') as bigint) >= 0:bigint) (cast((a_maxValue + 'x') as 
bigint) >= 0:bigint)
+ei     (cast((a + 'x') as bigint) >= 0:bigint) true:boolean
 cs     NOT (cast((a + 'x') as bigint) = 0:bigint)      true:boolean
-ei     NOT (cast((a + 'x') as bigint) = 0:bigint)      NOT ((cast((a_minValue 
+ 'x') as bigint) = 0:bigint) AND (cast((a_maxValue + 'x') as bigint) = 
0:bigint))
+ei     NOT (cast((a + 'x') as bigint) = 0:bigint)      true:boolean
 cs     (cast((a + 'x') as bigint) = cast(0:bigint as bigint))  true:boolean
-ei     (cast((a + 'x') as bigint) = cast(0:bigint as bigint))  
((cast((a_minValue + 'x') as bigint) <= cast(0:bigint as bigint)) AND 
(cast((a_maxValue + 'x') as bigint) >= cast(0:bigint as bigint)))
+ei     (cast((a + 'x') as bigint) = cast(0:bigint as bigint))  true:boolean
 cs     cast((a + 'x') as bigint) IN (0:bigint, null:bigint)    true:boolean
-ei     cast((a + 'x') as bigint) IN (0:bigint, null:bigint)    
(((cast((a_minValue + 'x') as bigint) <= 0:bigint) AND (cast((a_maxValue + 'x') 
as bigint) >= 0:bigint)) OR ((cast((a_minValue + 'x') as bigint) <= 
null:bigint) AND (cast((a_maxValue + 'x') as bigint) >= null:bigint)))
+ei     cast((a + 'x') as bigint) IN (0:bigint, null:bigint)    true:boolean
 cs     NOT cast((a + 'x') as bigint) IN (0:bigint)     true:boolean
-ei     NOT cast((a + 'x') as bigint) IN (0:bigint)     NOT ((cast((a_minValue 
+ 'x') as bigint) = 0:bigint) AND (cast((a_maxValue + 'x') as bigint) = 
0:bigint))
+ei     NOT cast((a + 'x') as bigint) IN (0:bigint)     true:boolean
 cs     startswith(cast((a + 'x') as bigint), 'ab')     true:boolean
-ei     startswith(cast((a + 'x') as bigint), 'ab')     ((cast((a_minValue + 
'x') as bigint) <= 'ab') AND (cast((a_maxValue + 'x') as bigint) >= 'ab'))
+ei     startswith(cast((a + 'x') as bigint), 'ab')     true:boolean
 cs     NOT startswith(cast((a + 'x') as bigint), 'ab') true:boolean
-ei     NOT startswith(cast((a + 'x') as bigint), 'ab') NOT 
(startswith(cast((a_minValue + 'x') as bigint), 'ab') AND 
startswith(cast((a_maxValue + 'x') as bigint), 'ab'))
+ei     NOT startswith(cast((a + 'x') as bigint), 'ab') true:boolean
 cs     (cast(f(a) as bigint) = 0:bigint)       true:boolean
 ei     (cast(f(a) as bigint) = 0:bigint)       true:boolean
 cs     (0:bigint < cast(f(a) as bigint))       true:boolean
@@ -989,28 +989,28 @@ cs        startswith(cast(to_date(s) as timestamp), 'ab') 
true:boolean
 ei     startswith(cast(to_date(s) as timestamp), 'ab') true:boolean
 cs     NOT startswith(cast(to_date(s) as timestamp), 'ab')     true:boolean
 ei     NOT startswith(cast(to_date(s) as timestamp), 'ab')     true:boolean
-cs     ((cast(a as bigint) + 1:bigint) = 0:bigint)     (((cast(a_minValue as 
bigint) + 1:bigint) <= 0:bigint) AND ((cast(a_maxValue as bigint) + 1:bigint) 
>= 0:bigint))
-cs     (0:bigint < (cast(a as bigint) + 1:bigint))     ((cast(a_maxValue as 
bigint) + 1:bigint) > 0:bigint)
-cs     ((cast(a as bigint) + 1:bigint) >= 0:bigint)    ((cast(a_maxValue as 
bigint) + 1:bigint) >= 0:bigint)
-cs     NOT ((cast(a as bigint) + 1:bigint) = 0:bigint) NOT (((cast(a_minValue 
as bigint) + 1:bigint) = 0:bigint) AND ((cast(a_maxValue as bigint) + 1:bigint) 
= 0:bigint))
-cs     ((cast(a as bigint) + 1:bigint) = cast(0:bigint as bigint))     
(((cast(a_minValue as bigint) + 1:bigint) <= cast(0:bigint as bigint)) AND 
((cast(a_maxValue as bigint) + 1:bigint) >= cast(0:bigint as bigint)))
-cs     (cast(a as bigint) + 1:bigint) IN (0:bigint, null:bigint)       
((((cast(a_minValue as bigint) + 1:bigint) <= 0:bigint) AND ((cast(a_maxValue 
as bigint) + 1:bigint) >= 0:bigint)) OR (((cast(a_minValue as bigint) + 
1:bigint) <= null:bigint) AND ((cast(a_maxValue as bigint) + 1:bigint) >= 
null:bigint)))
-cs     NOT (cast(a as bigint) + 1:bigint) IN (0:bigint)        NOT 
(((cast(a_minValue as bigint) + 1:bigint) = 0:bigint) AND ((cast(a_maxValue as 
bigint) + 1:bigint) = 0:bigint))
+cs     ((cast(a as bigint) + 1:bigint) = 0:bigint)     
coalesce(((if((cast(a_maxValue as bigint) <= 9223372036854775806:bigint), 
(cast(a_minValue as bigint) + 1:bigint), null:bigint) <= 0:bigint) AND 
(if((cast(a_maxValue as bigint) <= 9223372036854775806:bigint), 
(cast(a_maxValue as bigint) + 1:bigint), null:bigint) >= 0:bigint)), 
true:boolean)
+cs     (0:bigint < (cast(a as bigint) + 1:bigint))     
coalesce((if((cast(a_maxValue as bigint) <= 9223372036854775806:bigint), 
(cast(a_maxValue as bigint) + 1:bigint), null:bigint) > 0:bigint), true:boolean)
+cs     ((cast(a as bigint) + 1:bigint) >= 0:bigint)    
coalesce((if((cast(a_maxValue as bigint) <= 9223372036854775806:bigint), 
(cast(a_maxValue as bigint) + 1:bigint), null:bigint) >= 0:bigint), 
true:boolean)
+cs     NOT ((cast(a as bigint) + 1:bigint) = 0:bigint) coalesce(NOT 
((if((cast(a_maxValue as bigint) <= 9223372036854775806:bigint), 
(cast(a_minValue as bigint) + 1:bigint), null:bigint) = 0:bigint) AND 
(if((cast(a_maxValue as bigint) <= 9223372036854775806:bigint), 
(cast(a_maxValue as bigint) + 1:bigint), null:bigint) = 0:bigint)), 
true:boolean)
+cs     ((cast(a as bigint) + 1:bigint) = cast(0:bigint as bigint))     
coalesce(((if((cast(a_maxValue as bigint) <= 9223372036854775806:bigint), 
(cast(a_minValue as bigint) + 1:bigint), null:bigint) <= cast(0:bigint as 
bigint)) AND (if((cast(a_maxValue as bigint) <= 9223372036854775806:bigint), 
(cast(a_maxValue as bigint) + 1:bigint), null:bigint) >= cast(0:bigint as 
bigint))), true:boolean)
+cs     (cast(a as bigint) + 1:bigint) IN (0:bigint, null:bigint)       
coalesce((((if((cast(a_maxValue as bigint) <= 9223372036854775806:bigint), 
(cast(a_minValue as bigint) + 1:bigint), null:bigint) <= 0:bigint) AND 
(if((cast(a_maxValue as bigint) <= 9223372036854775806:bigint), 
(cast(a_maxValue as bigint) + 1:bigint), null:bigint) >= 0:bigint)) OR 
((if((cast(a_maxValue as bigint) <= 9223372036854775806:bigint), 
(cast(a_minValue as bigint) + 1:bigint), null:bigint) <= null:bigint) AND 
(if((cast(a [...]
+cs     NOT (cast(a as bigint) + 1:bigint) IN (0:bigint)        coalesce(NOT 
((if((cast(a_maxValue as bigint) <= 9223372036854775806:bigint), 
(cast(a_minValue as bigint) + 1:bigint), null:bigint) = 0:bigint) AND 
(if((cast(a_maxValue as bigint) <= 9223372036854775806:bigint), 
(cast(a_maxValue as bigint) + 1:bigint), null:bigint) = 0:bigint)), 
true:boolean)
 cs     startswith((cast(a as bigint) + 1:bigint), 'ab')        true:boolean
-ei     startswith((cast(a as bigint) + 1:bigint), 'ab')        
(((cast(a_minValue as bigint) + 1:bigint) <= 'ab') AND ((cast(a_maxValue as 
bigint) + 1:bigint) >= 'ab'))
+ei     startswith((cast(a as bigint) + 1:bigint), 'ab')        
coalesce(((if((cast(a_maxValue as bigint) <= 9223372036854775806:bigint), 
(cast(a_minValue as bigint) + 1:bigint), null:bigint) <= 'ab') AND 
(if((cast(a_maxValue as bigint) <= 9223372036854775806:bigint), 
(cast(a_maxValue as bigint) + 1:bigint), null:bigint) >= 'ab')), true:boolean)
 cs     NOT startswith((cast(a as bigint) + 1:bigint), 'ab')    true:boolean
-ei     NOT startswith((cast(a as bigint) + 1:bigint), 'ab')    NOT 
(startswith((cast(a_minValue as bigint) + 1:bigint), 'ab') AND 
startswith((cast(a_maxValue as bigint) + 1:bigint), 'ab'))
-cs     ((datediff(d, 19723:date) + 1:int) = 0:int)     (((datediff(d_minValue, 
19723:date) + 1:int) <= 0:int) AND ((datediff(d_maxValue, 19723:date) + 1:int) 
>= 0:int))
-cs     (0:int < (datediff(d, 19723:date) + 1:int))     ((datediff(d_maxValue, 
19723:date) + 1:int) > 0:int)
-cs     ((datediff(d, 19723:date) + 1:int) >= 0:int)    ((datediff(d_maxValue, 
19723:date) + 1:int) >= 0:int)
-cs     NOT ((datediff(d, 19723:date) + 1:int) = 0:int) NOT 
(((datediff(d_minValue, 19723:date) + 1:int) = 0:int) AND 
((datediff(d_maxValue, 19723:date) + 1:int) = 0:int))
-cs     ((datediff(d, 19723:date) + 1:int) = cast(0:int as int))        
(((datediff(d_minValue, 19723:date) + 1:int) <= cast(0:int as int)) AND 
((datediff(d_maxValue, 19723:date) + 1:int) >= cast(0:int as int)))
-cs     (datediff(d, 19723:date) + 1:int) IN (0:int, null:int)  
((((datediff(d_minValue, 19723:date) + 1:int) <= 0:int) AND 
((datediff(d_maxValue, 19723:date) + 1:int) >= 0:int)) OR 
(((datediff(d_minValue, 19723:date) + 1:int) <= null:int) AND 
((datediff(d_maxValue, 19723:date) + 1:int) >= null:int)))
-cs     NOT (datediff(d, 19723:date) + 1:int) IN (0:int)        NOT 
(((datediff(d_minValue, 19723:date) + 1:int) = 0:int) AND 
((datediff(d_maxValue, 19723:date) + 1:int) = 0:int))
+ei     NOT startswith((cast(a as bigint) + 1:bigint), 'ab')    coalesce(NOT 
(startswith(if((cast(a_maxValue as bigint) <= 9223372036854775806:bigint), 
(cast(a_minValue as bigint) + 1:bigint), null:bigint), 'ab') AND 
startswith(if((cast(a_maxValue as bigint) <= 9223372036854775806:bigint), 
(cast(a_maxValue as bigint) + 1:bigint), null:bigint), 'ab')), true:boolean)
+cs     ((datediff(d, 19723:date) + 1:int) = 0:int)     
coalesce(((if((datediff(d_maxValue, 19723:date) <= 2147483646:int), 
(datediff(d_minValue, 19723:date) + 1:int), null:int) <= 0:int) AND 
(if((datediff(d_maxValue, 19723:date) <= 2147483646:int), (datediff(d_maxValue, 
19723:date) + 1:int), null:int) >= 0:int)), true:boolean)
+cs     (0:int < (datediff(d, 19723:date) + 1:int))     
coalesce((if((datediff(d_maxValue, 19723:date) <= 2147483646:int), 
(datediff(d_maxValue, 19723:date) + 1:int), null:int) > 0:int), true:boolean)
+cs     ((datediff(d, 19723:date) + 1:int) >= 0:int)    
coalesce((if((datediff(d_maxValue, 19723:date) <= 2147483646:int), 
(datediff(d_maxValue, 19723:date) + 1:int), null:int) >= 0:int), true:boolean)
+cs     NOT ((datediff(d, 19723:date) + 1:int) = 0:int) coalesce(NOT 
((if((datediff(d_maxValue, 19723:date) <= 2147483646:int), 
(datediff(d_minValue, 19723:date) + 1:int), null:int) = 0:int) AND 
(if((datediff(d_maxValue, 19723:date) <= 2147483646:int), (datediff(d_maxValue, 
19723:date) + 1:int), null:int) = 0:int)), true:boolean)
+cs     ((datediff(d, 19723:date) + 1:int) = cast(0:int as int))        
coalesce(((if((datediff(d_maxValue, 19723:date) <= 2147483646:int), 
(datediff(d_minValue, 19723:date) + 1:int), null:int) <= cast(0:int as int)) 
AND (if((datediff(d_maxValue, 19723:date) <= 2147483646:int), 
(datediff(d_maxValue, 19723:date) + 1:int), null:int) >= cast(0:int as int))), 
true:boolean)
+cs     (datediff(d, 19723:date) + 1:int) IN (0:int, null:int)  
coalesce((((if((datediff(d_maxValue, 19723:date) <= 2147483646:int), 
(datediff(d_minValue, 19723:date) + 1:int), null:int) <= 0:int) AND 
(if((datediff(d_maxValue, 19723:date) <= 2147483646:int), (datediff(d_maxValue, 
19723:date) + 1:int), null:int) >= 0:int)) OR ((if((datediff(d_maxValue, 
19723:date) <= 2147483646:int), (datediff(d_minValue, 19723:date) + 1:int), 
null:int) <= null:int) AND (if((datediff(d_maxValue, 19723:date) <=  [...]
+cs     NOT (datediff(d, 19723:date) + 1:int) IN (0:int)        coalesce(NOT 
((if((datediff(d_maxValue, 19723:date) <= 2147483646:int), 
(datediff(d_minValue, 19723:date) + 1:int), null:int) = 0:int) AND 
(if((datediff(d_maxValue, 19723:date) <= 2147483646:int), (datediff(d_maxValue, 
19723:date) + 1:int), null:int) = 0:int)), true:boolean)
 cs     startswith((datediff(d, 19723:date) + 1:int), 'ab')     true:boolean
-ei     startswith((datediff(d, 19723:date) + 1:int), 'ab')     
(((datediff(d_minValue, 19723:date) + 1:int) <= 'ab') AND 
((datediff(d_maxValue, 19723:date) + 1:int) >= 'ab'))
+ei     startswith((datediff(d, 19723:date) + 1:int), 'ab')     
coalesce(((if((datediff(d_maxValue, 19723:date) <= 2147483646:int), 
(datediff(d_minValue, 19723:date) + 1:int), null:int) <= 'ab') AND 
(if((datediff(d_maxValue, 19723:date) <= 2147483646:int), (datediff(d_maxValue, 
19723:date) + 1:int), null:int) >= 'ab')), true:boolean)
 cs     NOT startswith((datediff(d, 19723:date) + 1:int), 'ab') true:boolean
-ei     NOT startswith((datediff(d, 19723:date) + 1:int), 'ab') NOT 
(startswith((datediff(d_minValue, 19723:date) + 1:int), 'ab') AND 
startswith((datediff(d_maxValue, 19723:date) + 1:int), 'ab'))
+ei     NOT startswith((datediff(d, 19723:date) + 1:int), 'ab') coalesce(NOT 
(startswith(if((datediff(d_maxValue, 19723:date) <= 2147483646:int), 
(datediff(d_minValue, 19723:date) + 1:int), null:int), 'ab') AND 
startswith(if((datediff(d_maxValue, 19723:date) <= 2147483646:int), 
(datediff(d_maxValue, 19723:date) + 1:int), null:int), 'ab')), true:boolean)
 cs     (concat(s, s) = '')     true:boolean
 cs     ('' < concat(s, s))     true:boolean
 cs     (concat(s, s) >= '')    true:boolean
@@ -1079,7 +1079,7 @@ ei        (((NOT startswith(date_add(d, dayofmonth(d)), 
'ab') AND d IS NOT NULL) OR fro
 cs     NOT (date_add(d, dayofmonth(d)) >= 0:date)      true:boolean
 cs     (NOT NOT (NOT (a | a) IN (0:int) OR (x / -2.0:double) IN (0.0:double, 
null:double)) OR NOT (startswith((a + a), 'ab') OR NOT (NOT 
startswith(to_utc_timestamp(ts, 'America/New_York'), 'ab') AND NOT (cast((a + 
'x') as bigint) = 0:bigint))))  true:boolean
 ei     (NOT NOT (NOT (a | a) IN (0:int) OR (x / -2.0:double) IN (0.0:double, 
null:double)) OR NOT (startswith((a + a), 'ab') OR NOT (NOT 
startswith(to_utc_timestamp(ts, 'America/New_York'), 'ab') AND NOT (cast((a + 
'x') as bigint) = 0:bigint))))  true:boolean
-cs     ((a * 2:int) >= 0:int)  ((a_maxValue * 2:int) >= 0:int)
+cs     ((a * 2:int) >= 0:int)  coalesce((if(((a_minValue >= -1073741824:int) 
AND (a_maxValue <= 1073741823:int)), (a_maxValue * 2:int), null:int) >= 0:int), 
true:boolean)
 cs     NOT NOT (shiftleft(a, 1:int) = 0:int)   true:boolean
 cs     (0:timestamp < from_utc_timestamp(ts, 'UTC'))   
(from_utc_timestamp(ts_maxValue, 'UTC') > 0:timestamp)
 cs     NOT (from_unixtime(l, 'yyyy-MM-dd') IN ('', null:string) OR NOT ((dec = 
cast(0.00:decimal(10,2) as decimal(10,2))) OR startswith(to_date(s, 
'yyyy-MM-dd'), 'ab')))      true:boolean
@@ -1093,21 +1093,21 @@ ei      NOT (NOT (NOT ((date_add(d, 1:int) = 0:date) 
AND NOT startswith(LOG1P(x), 'ab
 cs     (((((x / -2.0:double) >= 0.0:double) AND NOT to_unix_timestamp(ts, 
'yyyy-MM-dd') IN (0:bigint)) AND (NOT left(s, 2:int) IN ('') OR 
(to_timestamp(s, 'yyyy-MM-dd') >= 0:timestamp))) OR (((EXP(x) = 0.0:double) AND 
NOT x IN (0.0:double)) OR NOT NOT startswith(shiftleft(a, 1:int), 'ab')))    
true:boolean
 ei     (((((x / -2.0:double) >= 0.0:double) AND NOT to_unix_timestamp(ts, 
'yyyy-MM-dd') IN (0:bigint)) AND (NOT left(s, 2:int) IN ('') OR 
(to_timestamp(s, 'yyyy-MM-dd') >= 0:timestamp))) OR (((EXP(x) = 0.0:double) AND 
NOT x IN (0.0:double)) OR NOT NOT startswith(shiftleft(a, 1:int), 'ab')))    
true:boolean
 cs     NOT ((0:int < shiftleft(a, 1:int)) OR (false:boolean < cast(a as 
boolean)))     true:boolean
-cs     (dec * 1.5:decimal(2,1)) IN (0.000:decimal(13,3), null:decimal(13,3))   
((((dec_minValue * 1.5:decimal(2,1)) <= 0.000:decimal(13,3)) AND ((dec_maxValue 
* 1.5:decimal(2,1)) >= 0.000:decimal(13,3))) OR (((dec_minValue * 
1.5:decimal(2,1)) <= null:decimal(13,3)) AND ((dec_maxValue * 1.5:decimal(2,1)) 
>= null:decimal(13,3))))
+cs     (dec * 1.5:decimal(2,1)) IN (0.000:decimal(13,3), null:decimal(13,3))   
coalesce((((tryeval((dec_minValue * 1.5:decimal(2,1))) <= 0.000:decimal(13,3)) 
AND (tryeval((dec_maxValue * 1.5:decimal(2,1))) >= 0.000:decimal(13,3))) OR 
((tryeval((dec_minValue * 1.5:decimal(2,1))) <= null:decimal(13,3)) AND 
(tryeval((dec_maxValue * 1.5:decimal(2,1))) >= null:decimal(13,3)))), 
true:boolean)
 cs     ((NOT (0:int < shiftright(8:int, a)) AND (cast(a as string) = cast('' 
as string))) OR NOT to_unix_timestamp(ts, 'yyyy-MM-dd') IN (0:bigint))    
true:boolean
 cs     NOT (NOT ((cast(to_date(s) as timestamp) >= 0:timestamp) OR NOT 
(((0:int * a) = 0:int) OR ((a * a) = cast(0:int as int)))) OR NOT s IS NULL)    
true:boolean
-cs     ((a + 1:int) = cast(0:int as int))      (((a_minValue + 1:int) <= 
cast(0:int as int)) AND ((a_maxValue + 1:int) >= cast(0:int as int)))
+cs     ((a + 1:int) = cast(0:int as int))      coalesce(((if((a_maxValue <= 
2147483646:int), (a_minValue + 1:int), null:int) <= cast(0:int as int)) AND 
(if((a_maxValue <= 2147483646:int), (a_maxValue + 1:int), null:int) >= 
cast(0:int as int))), true:boolean)
 cs     NOT (startswith((a + 1:int), 'ab') AND ((0.000:decimal(13,3) < (dec * 
1.5:decimal(2,1))) AND NOT (NOT (a * -2:int) IN (0:int) OR (datediff(d, d) >= 
0:int))))   true:boolean
 ei     NOT (startswith((a + 1:int), 'ab') AND ((0.000:decimal(13,3) < (dec * 
1.5:decimal(2,1))) AND NOT (NOT (a * -2:int) IN (0:int) OR (datediff(d, d) >= 
0:int))))   true:boolean
 cs     (NOT (((from_unixtime(l, 'yyyy-MM-dd') = cast('' as string)) OR NOT (x 
= 0.0:double)) OR NOT (a + a) IN (0:int)) OR NOT (NOT (NOT 
startswith(to_date(s), 'ab') AND ((a + 'x') = cast(0:int as int))) OR NOT (NOT 
startswith((a + b), 'ab') AND dec IS NOT NULL)))       true:boolean
 ei     (NOT (((from_unixtime(l, 'yyyy-MM-dd') = cast('' as string)) OR NOT (x 
= 0.0:double)) OR NOT (a + a) IN (0:int)) OR NOT (NOT (NOT 
startswith(to_date(s), 'ab') AND ((a + 'x') = cast(0:int as int))) OR NOT (NOT 
startswith((a + b), 'ab') AND dec IS NOT NULL)))       true:boolean
 cs     ((((cast(a as bigint) + 1:bigint) = cast(0:bigint as bigint)) AND (NOT 
startswith(cast(dec as double), 'ab') AND NOT from_unixtime(l, 'yyyy-MM-dd') IN 
(''))) AND (NOT (date_add(d, 1:int) = 0:date) OR ((0:int * a) = cast(0:int as 
int))))    true:boolean
-ei     ((((cast(a as bigint) + 1:bigint) = cast(0:bigint as bigint)) AND (NOT 
startswith(cast(dec as double), 'ab') AND NOT from_unixtime(l, 'yyyy-MM-dd') IN 
(''))) AND (NOT (date_add(d, 1:int) = 0:date) OR ((0:int * a) = cast(0:int as 
int))))    ((((cast(a_minValue as bigint) + 1:bigint) <= cast(0:bigint as 
bigint)) AND ((cast(a_maxValue as bigint) + 1:bigint) >= cast(0:bigint as 
bigint))) AND (NOT (startswith(cast(dec_minValue as double), 'ab') AND 
startswith(cast(dec_maxValue as double), 'ab [...]
+ei     ((((cast(a as bigint) + 1:bigint) = cast(0:bigint as bigint)) AND (NOT 
startswith(cast(dec as double), 'ab') AND NOT from_unixtime(l, 'yyyy-MM-dd') IN 
(''))) AND (NOT (date_add(d, 1:int) = 0:date) OR ((0:int * a) = cast(0:int as 
int))))    (coalesce(((if((cast(a_maxValue as bigint) <= 
9223372036854775806:bigint), (cast(a_minValue as bigint) + 1:bigint), 
null:bigint) <= cast(0:bigint as bigint)) AND (if((cast(a_maxValue as bigint) 
<= 9223372036854775806:bigint), (cast(a_maxValue as bigint [...]
 cs     ((lower(s) = cast('' as string)) AND NOT ((x / -2.0:double) = 
cast(0.0:double as double)))      true:boolean
 cs     NOT (to_date(cast(ts as string)) = 0:date)      true:boolean
 cs     NOT (NOT (NOT shiftright(8:int, a) IN (0:int) AND ((cast(a as smallint) 
>= 0:smallint) AND (0:timestamp < from_utc_timestamp(ts, 'UTC')))) AND NOT (a = 
0:int)) true:boolean
 ei     NOT (NOT (NOT shiftright(8:int, a) IN (0:int) AND ((cast(a as smallint) 
>= 0:smallint) AND (0:timestamp < from_utc_timestamp(ts, 'UTC')))) AND NOT (a = 
0:int)) true:boolean
-cs     shiftleft(a, 1:int) IN (0:int, null:int)        
(((shiftleft(a_minValue, 1:int) <= 0:int) AND (shiftleft(a_maxValue, 1:int) >= 
0:int)) OR ((shiftleft(a_minValue, 1:int) <= null:int) AND 
(shiftleft(a_maxValue, 1:int) >= null:int)))
+cs     shiftleft(a, 1:int) IN (0:int, null:int)        
coalesce((((if(((a_minValue >= -1073741824:int) AND (a_maxValue <= 
1073741823:int)), shiftleft(a_minValue, 1:int), null:int) <= 0:int) AND 
(if(((a_minValue >= -1073741824:int) AND (a_maxValue <= 1073741823:int)), 
shiftleft(a_maxValue, 1:int), null:int) >= 0:int)) OR ((if(((a_minValue >= 
-1073741824:int) AND (a_maxValue <= 1073741823:int)), shiftleft(a_minValue, 
1:int), null:int) <= null:int) AND (if(((a_minValue >= -1073741824:int) AND 
(a_maxVa [...]
 cs     NOT (cast(a as bigint) = 0:bigint)      NOT ((cast(a_minValue as 
bigint) = 0:bigint) AND (cast(a_maxValue as bigint) = 0:bigint))
 cs     (NOT (substring(s, 1:int, 2:int) IN ('', null:string) OR (0:bigint < 
cast(a as bigint))) OR NOT (NOT (datediff(19723:date, d) IN (0:int, null:int) 
AND startswith(l, 'ab')) AND NOT ((a + b) IN (0:int, null:int) OR NOT (x / 
-2.0:double) IN (0.0:double))))   true:boolean
 ei     (NOT (substring(s, 1:int, 2:int) IN ('', null:string) OR (0:bigint < 
cast(a as bigint))) OR NOT (NOT (datediff(19723:date, d) IN (0:int, null:int) 
AND startswith(l, 'ab')) AND NOT ((a + b) IN (0:int, null:int) OR NOT (x / 
-2.0:double) IN (0.0:double))))   true:boolean
@@ -1122,7 +1122,7 @@ cs        a IS NOT NULL   ((a_nullCount IS NULL OR 
valueCount IS NULL) OR (a_nullCount <
 cs     NOT (((a + 1:int) = 0:int) AND NOT ((a + 1:int) IN (0:int, null:int) OR 
((cast(a as bigint) + 1:bigint) >= 0:bigint)))  true:boolean
 ei     NOT (((a + 1:int) = 0:int) AND NOT ((a + 1:int) IN (0:int, null:int) OR 
((cast(a as bigint) + 1:bigint) >= 0:bigint)))  true:boolean
 cs     (NOT (NOT (cast(ts as bigint) IN (0:bigint, null:bigint) OR ((x / x) = 
0.0:double)) AND (NOT ts IS NULL OR (datediff(d, 19723:date) = 0:int))) OR 
(cast(ts as string) = ''))    true:boolean
-cs     ((0:int < shiftleft(a, 1:int)) AND (2:int * a) IN (0:int, null:int))    
((shiftleft(a_maxValue, 1:int) > 0:int) AND ((((2:int * a_minValue) <= 0:int) 
AND ((2:int * a_maxValue) >= 0:int)) OR (((2:int * a_minValue) <= null:int) AND 
((2:int * a_maxValue) >= null:int))))
+cs     ((0:int < shiftleft(a, 1:int)) AND (2:int * a) IN (0:int, null:int))    
(coalesce((if(((a_minValue >= -1073741824:int) AND (a_maxValue <= 
1073741823:int)), shiftleft(a_maxValue, 1:int), null:int) > 0:int), 
true:boolean) AND coalesce((((if(((a_minValue >= -1073741824:int) AND 
(a_maxValue <= 1073741823:int)), (2:int * a_minValue), null:int) <= 0:int) AND 
(if(((a_minValue >= -1073741824:int) AND (a_maxValue <= 1073741823:int)), 
(2:int * a_maxValue), null:int) >= 0:int)) OR ((if(((a_minValue [...]
 cs     NOT (NOT ((cast(ts as bigint) = cast(0:bigint as bigint)) AND (0:int < 
datediff(d, d))) AND NOT (NOT substring(s, 1:int, 2:int) IN ('') AND 
(0:timestamp < to_timestamp(s, 'yyyy-MM-dd'))))     true:boolean
 cs     ((0.0:double < ln(EXP(x))) AND NOT ((ln(EXP(x)) IN (0.0:double, 
null:double) AND ((a + a) >= 0:int)) OR NOT (NOT cast((a + 1:int) as bigint) IN 
(0:bigint) AND NOT startswith(shiftleft(a, 1:int), 'ab'))))     true:boolean
 ei     ((0.0:double < ln(EXP(x))) AND NOT ((ln(EXP(x)) IN (0.0:double, 
null:double) AND ((a + a) >= 0:int)) OR NOT (NOT cast((a + 1:int) as bigint) IN 
(0:bigint) AND NOT startswith(shiftleft(a, 1:int), 'ab'))))     
coalesce((tryeval(ln(EXP(x_maxValue))) > 0.0:double), true:boolean)
@@ -1153,7 +1153,7 @@ cs        (((date_add(cast(ts as date), 1:int) >= 0:date) 
AND (to_unix_timestamp(s, 'yy
 cs     NOT ((NOT (d = 0:date) OR NOT to_unix_timestamp(s, 'yyyy-MM-dd') IN 
(0:bigint)) AND (NOT startswith(date_format(ts, cast(ts as string)), 'ab') OR 
NOT (startswith((a + a), 'ab') OR ((a * a) = cast(0:int as int)))))   
true:boolean
 ei     NOT ((NOT (d = 0:date) OR NOT to_unix_timestamp(s, 'yyyy-MM-dd') IN 
(0:bigint)) AND (NOT startswith(date_format(ts, cast(ts as string)), 'ab') OR 
NOT (startswith((a + a), 'ab') OR ((a * a) = cast(0:int as int)))))   
true:boolean
 cs     startswith((2:int * a), 'ab')   true:boolean
-ei     startswith((2:int * a), 'ab')   (((2:int * a_minValue) <= 'ab') AND 
((2:int * a_maxValue) >= 'ab'))
+ei     startswith((2:int * a), 'ab')   coalesce(((if(((a_minValue >= 
-1073741824:int) AND (a_maxValue <= 1073741823:int)), (2:int * a_minValue), 
null:int) <= 'ab') AND (if(((a_minValue >= -1073741824:int) AND (a_maxValue <= 
1073741823:int)), (2:int * a_maxValue), null:int) >= 'ab')), true:boolean)
 cs     st INSET (struct(0:int))        true:boolean
 cs     st IN (struct(0:int))   true:boolean
 cs     (st = struct(0:int))    true:boolean
@@ -1277,3 +1277,58 @@ cs       from_unixtime(l, 'dd-MM-yyyy') IN ('', 
null:string)     true:boolean
 cs     NOT from_unixtime(l, 'dd-MM-yyyy') IN ('')      true:boolean
 cs     startswith(from_unixtime(l, 'dd-MM-yyyy'), 'ab')        true:boolean
 cs     NOT startswith(from_unixtime(l, 'dd-MM-yyyy'), 'ab')    true:boolean
+cs     (shiftleft(a, 33:int) = 0:int)  coalesce(((if(((a_minValue >= 
-1073741824:int) AND (a_maxValue <= 1073741823:int)), shiftleft(a_minValue, 
33:int), null:int) <= 0:int) AND (if(((a_minValue >= -1073741824:int) AND 
(a_maxValue <= 1073741823:int)), shiftleft(a_maxValue, 33:int), null:int) >= 
0:int)), true:boolean)
+cs     (0:int < shiftleft(a, 33:int))  coalesce((if(((a_minValue >= 
-1073741824:int) AND (a_maxValue <= 1073741823:int)), shiftleft(a_maxValue, 
33:int), null:int) > 0:int), true:boolean)
+cs     (shiftleft(a, 33:int) >= 0:int) coalesce((if(((a_minValue >= 
-1073741824:int) AND (a_maxValue <= 1073741823:int)), shiftleft(a_maxValue, 
33:int), null:int) >= 0:int), true:boolean)
+cs     NOT (shiftleft(a, 33:int) = 0:int)      coalesce(NOT ((if(((a_minValue 
>= -1073741824:int) AND (a_maxValue <= 1073741823:int)), shiftleft(a_minValue, 
33:int), null:int) = 0:int) AND (if(((a_minValue >= -1073741824:int) AND 
(a_maxValue <= 1073741823:int)), shiftleft(a_maxValue, 33:int), null:int) = 
0:int)), true:boolean)
+cs     (shiftleft(a, 33:int) = cast(0:int as int))     
coalesce(((if(((a_minValue >= -1073741824:int) AND (a_maxValue <= 
1073741823:int)), shiftleft(a_minValue, 33:int), null:int) <= cast(0:int as 
int)) AND (if(((a_minValue >= -1073741824:int) AND (a_maxValue <= 
1073741823:int)), shiftleft(a_maxValue, 33:int), null:int) >= cast(0:int as 
int))), true:boolean)
+cs     shiftleft(a, 33:int) IN (0:int, null:int)       
coalesce((((if(((a_minValue >= -1073741824:int) AND (a_maxValue <= 
1073741823:int)), shiftleft(a_minValue, 33:int), null:int) <= 0:int) AND 
(if(((a_minValue >= -1073741824:int) AND (a_maxValue <= 1073741823:int)), 
shiftleft(a_maxValue, 33:int), null:int) >= 0:int)) OR ((if(((a_minValue >= 
-1073741824:int) AND (a_maxValue <= 1073741823:int)), shiftleft(a_minValue, 
33:int), null:int) <= null:int) AND (if(((a_minValue >= -1073741824:int) AND 
(a_m [...]
+cs     NOT shiftleft(a, 33:int) IN (0:int)     coalesce(NOT ((if(((a_minValue 
>= -1073741824:int) AND (a_maxValue <= 1073741823:int)), shiftleft(a_minValue, 
33:int), null:int) = 0:int) AND (if(((a_minValue >= -1073741824:int) AND 
(a_maxValue <= 1073741823:int)), shiftleft(a_maxValue, 33:int), null:int) = 
0:int)), true:boolean)
+cs     startswith(shiftleft(a, 33:int), 'ab')  true:boolean
+ei     startswith(shiftleft(a, 33:int), 'ab')  coalesce(((if(((a_minValue >= 
-1073741824:int) AND (a_maxValue <= 1073741823:int)), shiftleft(a_minValue, 
33:int), null:int) <= 'ab') AND (if(((a_minValue >= -1073741824:int) AND 
(a_maxValue <= 1073741823:int)), shiftleft(a_maxValue, 33:int), null:int) >= 
'ab')), true:boolean)
+cs     NOT startswith(shiftleft(a, 33:int), 'ab')      true:boolean
+ei     NOT startswith(shiftleft(a, 33:int), 'ab')      coalesce(NOT 
(startswith(if(((a_minValue >= -1073741824:int) AND (a_maxValue <= 
1073741823:int)), shiftleft(a_minValue, 33:int), null:int), 'ab') AND 
startswith(if(((a_minValue >= -1073741824:int) AND (a_maxValue <= 
1073741823:int)), shiftleft(a_maxValue, 33:int), null:int), 'ab')), 
true:boolean)
+cs     ((sm + 1:smallint) = 0:smallint)        coalesce(((if((sm_maxValue <= 
32766:smallint), (sm_minValue + 1:smallint), null:smallint) <= 0:smallint) AND 
(if((sm_maxValue <= 32766:smallint), (sm_maxValue + 1:smallint), null:smallint) 
>= 0:smallint)), true:boolean)
+cs     (0:smallint < (sm + 1:smallint))        coalesce((if((sm_maxValue <= 
32766:smallint), (sm_maxValue + 1:smallint), null:smallint) > 0:smallint), 
true:boolean)
+cs     ((sm + 1:smallint) >= 0:smallint)       coalesce((if((sm_maxValue <= 
32766:smallint), (sm_maxValue + 1:smallint), null:smallint) >= 0:smallint), 
true:boolean)
+cs     NOT ((sm + 1:smallint) = 0:smallint)    coalesce(NOT ((if((sm_maxValue 
<= 32766:smallint), (sm_minValue + 1:smallint), null:smallint) = 0:smallint) 
AND (if((sm_maxValue <= 32766:smallint), (sm_maxValue + 1:smallint), 
null:smallint) = 0:smallint)), true:boolean)
+cs     ((sm + 1:smallint) = cast(0:smallint as smallint))      
coalesce(((if((sm_maxValue <= 32766:smallint), (sm_minValue + 1:smallint), 
null:smallint) <= cast(0:smallint as smallint)) AND (if((sm_maxValue <= 
32766:smallint), (sm_maxValue + 1:smallint), null:smallint) >= cast(0:smallint 
as smallint))), true:boolean)
+cs     (sm + 1:smallint) IN (0:smallint, null:smallint)        
coalesce((((if((sm_maxValue <= 32766:smallint), (sm_minValue + 1:smallint), 
null:smallint) <= 0:smallint) AND (if((sm_maxValue <= 32766:smallint), 
(sm_maxValue + 1:smallint), null:smallint) >= 0:smallint)) OR ((if((sm_maxValue 
<= 32766:smallint), (sm_minValue + 1:smallint), null:smallint) <= 
null:smallint) AND (if((sm_maxValue <= 32766:smallint), (sm_maxValue + 
1:smallint), null:smallint) >= null:smallint))), true:boolean)
+cs     NOT (sm + 1:smallint) IN (0:smallint)   coalesce(NOT ((if((sm_maxValue 
<= 32766:smallint), (sm_minValue + 1:smallint), null:smallint) = 0:smallint) 
AND (if((sm_maxValue <= 32766:smallint), (sm_maxValue + 1:smallint), 
null:smallint) = 0:smallint)), true:boolean)
+cs     startswith((sm + 1:smallint), 'ab')     true:boolean
+ei     startswith((sm + 1:smallint), 'ab')     coalesce(((if((sm_maxValue <= 
32766:smallint), (sm_minValue + 1:smallint), null:smallint) <= 'ab') AND 
(if((sm_maxValue <= 32766:smallint), (sm_maxValue + 1:smallint), null:smallint) 
>= 'ab')), true:boolean)
+cs     NOT startswith((sm + 1:smallint), 'ab') true:boolean
+ei     NOT startswith((sm + 1:smallint), 'ab') coalesce(NOT 
(startswith(if((sm_maxValue <= 32766:smallint), (sm_minValue + 1:smallint), 
null:smallint), 'ab') AND startswith(if((sm_maxValue <= 32766:smallint), 
(sm_maxValue + 1:smallint), null:smallint), 'ab')), true:boolean)
+cs     ((tn * 3:tinyint) = 0:tinyint)  coalesce(((if(((tn_minValue >= 
-42:tinyint) AND (tn_maxValue <= 42:tinyint)), (tn_minValue * 3:tinyint), 
null:tinyint) <= 0:tinyint) AND (if(((tn_minValue >= -42:tinyint) AND 
(tn_maxValue <= 42:tinyint)), (tn_maxValue * 3:tinyint), null:tinyint) >= 
0:tinyint)), true:boolean)
+cs     (0:tinyint < (tn * 3:tinyint))  coalesce((if(((tn_minValue >= 
-42:tinyint) AND (tn_maxValue <= 42:tinyint)), (tn_maxValue * 3:tinyint), 
null:tinyint) > 0:tinyint), true:boolean)
+cs     ((tn * 3:tinyint) >= 0:tinyint) coalesce((if(((tn_minValue >= 
-42:tinyint) AND (tn_maxValue <= 42:tinyint)), (tn_maxValue * 3:tinyint), 
null:tinyint) >= 0:tinyint), true:boolean)
+cs     NOT ((tn * 3:tinyint) = 0:tinyint)      coalesce(NOT ((if(((tn_minValue 
>= -42:tinyint) AND (tn_maxValue <= 42:tinyint)), (tn_minValue * 3:tinyint), 
null:tinyint) = 0:tinyint) AND (if(((tn_minValue >= -42:tinyint) AND 
(tn_maxValue <= 42:tinyint)), (tn_maxValue * 3:tinyint), null:tinyint) = 
0:tinyint)), true:boolean)
+cs     ((tn * 3:tinyint) = cast(0:tinyint as tinyint)) 
coalesce(((if(((tn_minValue >= -42:tinyint) AND (tn_maxValue <= 42:tinyint)), 
(tn_minValue * 3:tinyint), null:tinyint) <= cast(0:tinyint as tinyint)) AND 
(if(((tn_minValue >= -42:tinyint) AND (tn_maxValue <= 42:tinyint)), 
(tn_maxValue * 3:tinyint), null:tinyint) >= cast(0:tinyint as tinyint))), 
true:boolean)
+cs     (tn * 3:tinyint) IN (0:tinyint, null:tinyint)   
coalesce((((if(((tn_minValue >= -42:tinyint) AND (tn_maxValue <= 42:tinyint)), 
(tn_minValue * 3:tinyint), null:tinyint) <= 0:tinyint) AND (if(((tn_minValue >= 
-42:tinyint) AND (tn_maxValue <= 42:tinyint)), (tn_maxValue * 3:tinyint), 
null:tinyint) >= 0:tinyint)) OR ((if(((tn_minValue >= -42:tinyint) AND 
(tn_maxValue <= 42:tinyint)), (tn_minValue * 3:tinyint), null:tinyint) <= 
null:tinyint) AND (if(((tn_minValue >= -42:tinyint) AND (tn_maxVa [...]
+cs     NOT (tn * 3:tinyint) IN (0:tinyint)     coalesce(NOT ((if(((tn_minValue 
>= -42:tinyint) AND (tn_maxValue <= 42:tinyint)), (tn_minValue * 3:tinyint), 
null:tinyint) = 0:tinyint) AND (if(((tn_minValue >= -42:tinyint) AND 
(tn_maxValue <= 42:tinyint)), (tn_maxValue * 3:tinyint), null:tinyint) = 
0:tinyint)), true:boolean)
+cs     startswith((tn * 3:tinyint), 'ab')      true:boolean
+ei     startswith((tn * 3:tinyint), 'ab')      coalesce(((if(((tn_minValue >= 
-42:tinyint) AND (tn_maxValue <= 42:tinyint)), (tn_minValue * 3:tinyint), 
null:tinyint) <= 'ab') AND (if(((tn_minValue >= -42:tinyint) AND (tn_maxValue 
<= 42:tinyint)), (tn_maxValue * 3:tinyint), null:tinyint) >= 'ab')), 
true:boolean)
+cs     NOT startswith((tn * 3:tinyint), 'ab')  true:boolean
+ei     NOT startswith((tn * 3:tinyint), 'ab')  coalesce(NOT 
(startswith(if(((tn_minValue >= -42:tinyint) AND (tn_maxValue <= 42:tinyint)), 
(tn_minValue * 3:tinyint), null:tinyint), 'ab') AND startswith(if(((tn_minValue 
>= -42:tinyint) AND (tn_maxValue <= 42:tinyint)), (tn_maxValue * 3:tinyint), 
null:tinyint), 'ab')), true:boolean)
+cs     ((dec + 1:decimal(10,2)) = 0.00:decimal(11,2))  
coalesce(((tryeval((dec_minValue + 1:decimal(10,2))) <= 0.00:decimal(11,2)) AND 
(tryeval((dec_maxValue + 1:decimal(10,2))) >= 0.00:decimal(11,2))), 
true:boolean)
+cs     (0.00:decimal(11,2) < (dec + 1:decimal(10,2)))  
coalesce((tryeval((dec_maxValue + 1:decimal(10,2))) > 0.00:decimal(11,2)), 
true:boolean)
+cs     ((dec + 1:decimal(10,2)) >= 0.00:decimal(11,2)) 
coalesce((tryeval((dec_maxValue + 1:decimal(10,2))) >= 0.00:decimal(11,2)), 
true:boolean)
+cs     NOT ((dec + 1:decimal(10,2)) = 0.00:decimal(11,2))      coalesce(NOT 
((tryeval((dec_minValue + 1:decimal(10,2))) = 0.00:decimal(11,2)) AND 
(tryeval((dec_maxValue + 1:decimal(10,2))) = 0.00:decimal(11,2))), true:boolean)
+cs     ((dec + 1:decimal(10,2)) = cast(0.00:decimal(11,2) as decimal(11,2)))   
coalesce(((tryeval((dec_minValue + 1:decimal(10,2))) <= cast(0.00:decimal(11,2) 
as decimal(11,2))) AND (tryeval((dec_maxValue + 1:decimal(10,2))) >= 
cast(0.00:decimal(11,2) as decimal(11,2)))), true:boolean)
+cs     (dec + 1:decimal(10,2)) IN (0.00:decimal(11,2), null:decimal(11,2))     
coalesce((((tryeval((dec_minValue + 1:decimal(10,2))) <= 0.00:decimal(11,2)) 
AND (tryeval((dec_maxValue + 1:decimal(10,2))) >= 0.00:decimal(11,2))) OR 
((tryeval((dec_minValue + 1:decimal(10,2))) <= null:decimal(11,2)) AND 
(tryeval((dec_maxValue + 1:decimal(10,2))) >= null:decimal(11,2)))), 
true:boolean)
+cs     NOT (dec + 1:decimal(10,2)) IN (0.00:decimal(11,2))     coalesce(NOT 
((tryeval((dec_minValue + 1:decimal(10,2))) = 0.00:decimal(11,2)) AND 
(tryeval((dec_maxValue + 1:decimal(10,2))) = 0.00:decimal(11,2))), true:boolean)
+cs     startswith((dec + 1:decimal(10,2)), 'ab')       true:boolean
+ei     startswith((dec + 1:decimal(10,2)), 'ab')       
coalesce(((tryeval((dec_minValue + 1:decimal(10,2))) <= 'ab') AND 
(tryeval((dec_maxValue + 1:decimal(10,2))) >= 'ab')), true:boolean)
+cs     NOT startswith((dec + 1:decimal(10,2)), 'ab')   true:boolean
+ei     NOT startswith((dec + 1:decimal(10,2)), 'ab')   coalesce(NOT 
(startswith(tryeval((dec_minValue + 1:decimal(10,2))), 'ab') AND 
startswith(tryeval((dec_maxValue + 1:decimal(10,2))), 'ab')), true:boolean)
+cs     ((dec / 2:decimal(10,2)) = 0E-13:decimal(23,13))        
coalesce(((tryeval((dec_minValue / 2:decimal(10,2))) <= 0E-13:decimal(23,13)) 
AND (tryeval((dec_maxValue / 2:decimal(10,2))) >= 0E-13:decimal(23,13))), 
true:boolean)
+cs     (0E-13:decimal(23,13) < (dec / 2:decimal(10,2)))        
coalesce((tryeval((dec_maxValue / 2:decimal(10,2))) > 0E-13:decimal(23,13)), 
true:boolean)
+cs     ((dec / 2:decimal(10,2)) >= 0E-13:decimal(23,13))       
coalesce((tryeval((dec_maxValue / 2:decimal(10,2))) >= 0E-13:decimal(23,13)), 
true:boolean)
+cs     NOT ((dec / 2:decimal(10,2)) = 0E-13:decimal(23,13))    coalesce(NOT 
((tryeval((dec_minValue / 2:decimal(10,2))) = 0E-13:decimal(23,13)) AND 
(tryeval((dec_maxValue / 2:decimal(10,2))) = 0E-13:decimal(23,13))), 
true:boolean)
+cs     ((dec / 2:decimal(10,2)) = cast(0E-13:decimal(23,13) as 
decimal(23,13)))        coalesce(((tryeval((dec_minValue / 2:decimal(10,2))) <= 
cast(0E-13:decimal(23,13) as decimal(23,13))) AND (tryeval((dec_maxValue / 
2:decimal(10,2))) >= cast(0E-13:decimal(23,13) as decimal(23,13)))), 
true:boolean)
+cs     (dec / 2:decimal(10,2)) IN (0E-13:decimal(23,13), null:decimal(23,13))  
coalesce((((tryeval((dec_minValue / 2:decimal(10,2))) <= 0E-13:decimal(23,13)) 
AND (tryeval((dec_maxValue / 2:decimal(10,2))) >= 0E-13:decimal(23,13))) OR 
((tryeval((dec_minValue / 2:decimal(10,2))) <= null:decimal(23,13)) AND 
(tryeval((dec_maxValue / 2:decimal(10,2))) >= null:decimal(23,13)))), 
true:boolean)
+cs     NOT (dec / 2:decimal(10,2)) IN (0E-13:decimal(23,13))   coalesce(NOT 
((tryeval((dec_minValue / 2:decimal(10,2))) = 0E-13:decimal(23,13)) AND 
(tryeval((dec_maxValue / 2:decimal(10,2))) = 0E-13:decimal(23,13))), 
true:boolean)
+cs     startswith((dec / 2:decimal(10,2)), 'ab')       true:boolean
+ei     startswith((dec / 2:decimal(10,2)), 'ab')       
coalesce(((tryeval((dec_minValue / 2:decimal(10,2))) <= 'ab') AND 
(tryeval((dec_maxValue / 2:decimal(10,2))) >= 'ab')), true:boolean)
+cs     NOT startswith((dec / 2:decimal(10,2)), 'ab')   true:boolean
+ei     NOT startswith((dec / 2:decimal(10,2)), 'ab')   coalesce(NOT 
(startswith(tryeval((dec_minValue / 2:decimal(10,2))), 'ab') AND 
startswith(tryeval((dec_maxValue / 2:decimal(10,2))), 'ab')), true:boolean)
diff --git 
a/hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/hudi/DataSkippingGoldenInputs.scala
 
b/hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/hudi/DataSkippingGoldenInputs.scala
index 50f5ca656cc4..ba6616633056 100644
--- 
a/hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/hudi/DataSkippingGoldenInputs.scala
+++ 
b/hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/hudi/DataSkippingGoldenInputs.scala
@@ -21,7 +21,7 @@ import org.apache.spark.sql.catalyst.InternalRow
 import org.apache.spark.sql.catalyst.analysis.{UnresolvedAttribute, 
UnresolvedFunction}
 import org.apache.spark.sql.catalyst.expressions.{Abs, Add, And, 
AttributeReference, BinaryOperator, BitwiseOr, Cast, Coalesce, Concat, DateAdd, 
DateDiff, DateFormatClass, DateSub, DayOfMonth, Divide, EqualNullSafe, EqualTo, 
Exp, Expm1, Expression, FromUnixTime, FromUTCTimestamp, GreaterThanOrEqual, In, 
InSet, IsNotNull, IsNull, LessThan, Literal, Log, Log10, Log1p, Log2, Lower, 
Multiply, Not, Or, ParseToDate, ParseToTimestamp, ShiftLeft, ShiftRight, 
StartsWith, Substring, TimeZoneAwareE [...]
 import org.apache.spark.sql.catalyst.util.ArrayData
-import org.apache.spark.sql.types.{ArrayType, BooleanType, DataType, DateType, 
Decimal, DecimalType, DoubleType, IntegerType, LongType, ShortType, StringType, 
StructField, StructType, TimestampType}
+import org.apache.spark.sql.types.{ArrayType, BooleanType, ByteType, DataType, 
DateType, Decimal, DecimalType, DoubleType, IntegerType, LongType, ShortType, 
StringType, StructField, StructType, TimestampType}
 
 import java.time.LocalDate
 
@@ -37,7 +37,7 @@ import scala.util.{Random, Try}
  */
 object DataSkippingGoldenInputs {
 
-  val indexedCols: Seq[String] = Seq("a", "l", "d", "ts", "s", "x", "dec")
+  val indexedCols: Seq[String] = Seq("a", "l", "d", "ts", "s", "x", "dec", 
"sm", "tn")
 
   private val a = AttributeReference("a", IntegerType)()
   // Not indexed
@@ -48,6 +48,9 @@ object DataSkippingGoldenInputs {
   private val s = AttributeReference("s", StringType)()
   private val x = AttributeReference("x", DoubleType)()
   private val dec = AttributeReference("dec", DecimalType(10, 2))()
+  // Only in [[overflowTerms]], so not in [[columns]]
+  private val sm = AttributeReference("sm", ShortType)()
+  private val tn = AttributeReference("tn", ByteType)()
 
   private val columns: Seq[Expression] = Seq(a, b, l, d, ts, s, x, dec)
 
@@ -117,6 +120,21 @@ object DataSkippingGoldenInputs {
     DateFormatClass(ts, Literal("MM/dd/yyyy"), Some("UTC")),
     FromUnixTime(l, Literal("dd-MM-yyyy"), Some("UTC")))
 
+  /**
+   * Overflowing arithmetic terms (#20460) added after the golden file was 
first generated, kept out
+   * of [[terms]] for the same reason as [[dateTimeTerms]].
+   *
+   * An int shifts by the low 5 bits of the amount, which 33 pins (a 6-bit 
mask would shift by 33).
+   * The smallint and tinyint terms take a literal of their own type, as an 
int literal would widen
+   * the result to int. Decimal results overflow into NULL instead, so their 
ranges are partial.
+   */
+  private val overflowTerms: Seq[Expression] = Seq(
+    ShiftLeft(a, Literal(33)),
+    Add(sm, Literal(1.toShort)),
+    Multiply(tn, Literal(3.toByte)),
+    Add(dec, Literal(Decimal(1), DecimalType(10, 2))),
+    Divide(dec, Literal(Decimal(2), DecimalType(10, 2))))
+
   /**
    * Sets a time zone wherever the analyzer would, so that resolution does not 
depend on the Spark
    * version (for ex, `cast(s as date)` needs a time zone on Spark 3.5 but not 
on Spark 4). Inputs
@@ -148,7 +166,7 @@ object DataSkippingGoldenInputs {
 
   /**
    * Every input, in golden file order: the leaves, a seeded sample of AND / 
OR / NOT trees, the
-   * struct and array leaves, then the leaves of [[dateTimeTerms]].
+   * struct and array leaves, the leaves of [[dateTimeTerms]], then the leaves 
of [[overflowTerms]].
    */
   def inputs: Seq[Expression] = {
     val allLeaves = terms.map(withTimeZone).flatMap(leaves).map(withTimeZone)
@@ -166,7 +184,8 @@ object DataSkippingGoldenInputs {
         }
       }
     allLeaves ++ (1 to 60).map(_ => tree(3)) ++ nestedLeaves ++
-      dateTimeTerms.map(withTimeZone).flatMap(leaves).map(withTimeZone)
+      dateTimeTerms.map(withTimeZone).flatMap(leaves).map(withTimeZone) ++
+      overflowTerms.map(withTimeZone).flatMap(leaves).map(withTimeZone)
   }
 
   /**
diff --git 
a/hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/hudi/TestDataSkippingUtils.scala
 
b/hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/hudi/TestDataSkippingUtils.scala
index 1d804facbca8..e18b9a419e78 100644
--- 
a/hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/hudi/TestDataSkippingUtils.scala
+++ 
b/hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/hudi/TestDataSkippingUtils.scala
@@ -207,16 +207,17 @@ class TestDataSkippingUtils extends 
HoodieSparkClientTestBase with SparkAdapterS
 
 
   @ParameterizedTest
-  @MethodSource(Array("testDateTimeFilterExpressionsSource"))
-  def testDateTimeLookupThroughFullOptimizer(sourceFilterExprStr: String,
-                                             input: Seq[IndexRow],
-                                             expectedOutput: Seq[String]): 
Unit = {
+  @MethodSource(Array("testDateTimeFilterExpressionsSource", 
"testIntegralOverflowSource"))
+  def testLookupThroughFullOptimizer(sourceFilterExprStr: String,
+                                     input: Seq[IndexRow],
+                                     expectedOutput: Seq[String]): Unit = {
     // We have to fix the timezone to make sure all date-bound utilities output
     // is consistent with the fixtures
     spark.sqlContext.setConf(SESSION_LOCAL_TIMEZONE.key, "UTC")
 
-    // ANSI flips the parse expressions to throw on unparseable input (ANSI is 
the default on
-    // Spark 4): the outcome must be the same either way, and the lookup must 
not throw
+    // ANSI flips the parse expressions to throw on unparseable input, and 
integral and decimal
+    // arithmetic to throw on overflow, except `shiftleft`, which wraps around 
in either mode (ANSI is
+    // the default on Spark 4): the outcome must be the same either way, and 
the lookup must not throw
     Seq("false", "true").foreach { ansi =>
       withSqlConf(ANSI_ENABLED.key -> ansi) {
         assertEquals(expectedOutput, 
lookupThroughFullOptimizer(sourceFilterExprStr, input), s"ANSI $ansi")
@@ -1188,4 +1189,105 @@ object TestDataSkippingUtils {
         Seq("file_1"))
     )
   }
+
+  def testIntegralOverflowSource(): java.util.stream.Stream[Arguments] = {
+    java.util.stream.Stream.of(
+      // Issue #20460 repros: integral arithmetic wraps around on overflow in 
non-ANSI mode, so
+      // re-applying it over min/max stats maps the max below the min and 
would wrongly prune
+      // file_1, whose first row matches (51 * 2 = 102, 0 + 1 = 1, 1 << 1 = 
2). The file may
+      // overflow, so its bounds are unknown and it is kept
+      arguments(
+        "A * 2L > 100",
+        Seq(
+          IndexRow("file_1", valueCount = 2, A_minValue = 51, A_maxValue = 
Long.MaxValue, A_nullCount = 0)
+        ),
+        Seq("file_1")),
+      arguments(
+        "A + 1 > 0",
+        Seq(
+          IndexRow("file_1", valueCount = 2, A_minValue = 0, A_maxValue = 
Long.MaxValue, A_nullCount = 0)
+        ),
+        Seq("file_1")),
+      arguments(
+        "shiftleft(A, 1) > 0",
+        Seq(
+          IndexRow("file_1", valueCount = 2, A_minValue = 1, A_maxValue = 
Long.MaxValue, A_nullCount = 0)
+        ),
+        Seq("file_1")),
+      // Integral arithmetic still prunes files that cannot overflow. At the 
limit (file_1) the
+      // bounds are exact and prune; one past it (file_2) a row wraps around 
in non-ANSI mode and
+      // matches (for ex, Long.MaxValue + 1 = Long.MinValue < 0), so the file 
is kept
+      arguments(
+        "A + 1 < 0",
+        Seq(
+          IndexRow("file_1", valueCount = 2, A_minValue = Long.MaxValue - 10, 
A_maxValue = Long.MaxValue - 1, A_nullCount = 0),
+          IndexRow("file_2", valueCount = 2, A_minValue = Long.MaxValue - 10, 
A_maxValue = Long.MaxValue, A_nullCount = 0)
+        ),
+        Seq("file_2")),
+      arguments(
+        "A + -1 > 0",
+        Seq(
+          IndexRow("file_1", valueCount = 2, A_minValue = Long.MinValue + 1, 
A_maxValue = Long.MinValue + 10, A_nullCount = 0),
+          IndexRow("file_2", valueCount = 2, A_minValue = Long.MinValue, 
A_maxValue = Long.MinValue + 10, A_nullCount = 0)
+        ),
+        Seq("file_2")),
+      // Long.MinValue / 3 does not divide evenly, so the min limit rounds 
towards zero
+      arguments(
+        "A * 3L < 0",
+        Seq(
+          IndexRow("file_1", valueCount = 2, A_minValue = 1, A_maxValue = 
Long.MaxValue / 3, A_nullCount = 0),
+          IndexRow("file_2", valueCount = 2, A_minValue = 1, A_maxValue = 
Long.MaxValue / 3 + 1, A_nullCount = 0)
+        ),
+        Seq("file_2")),
+      arguments(
+        "A * 3L > 0",
+        Seq(
+          IndexRow("file_1", valueCount = 2, A_minValue = Long.MinValue / 3, 
A_maxValue = -1, A_nullCount = 0),
+          IndexRow("file_2", valueCount = 2, A_minValue = Long.MinValue / 3 - 
1, A_maxValue = -1, A_nullCount = 0)
+        ),
+        Seq("file_2")),
+      // A bigint shifts by the low 6 bits of the amount, and 33 pins that 
width: a 5-bit mask would
+      // shift by 1. One past the limit (file_2), 2^30 << 33 wraps around to 
Long.MinValue < 0
+      arguments(
+        "shiftleft(A, 33) < 0",
+        Seq(
+          IndexRow("file_1", valueCount = 2, A_minValue = 1, A_maxValue = 
Long.MaxValue >> 33, A_nullCount = 0),
+          IndexRow("file_2", valueCount = 2, A_minValue = 1, A_maxValue = 
(Long.MaxValue >> 33) + 1, A_nullCount = 0)
+        ),
+        Seq("file_2")),
+      // Floating-point addition saturates to infinity instead, so it still 
translates and prunes
+      arguments(
+        "CAST(A AS DOUBLE) + 1.0D > 101.0D",
+        Seq(
+          IndexRow("file_1", valueCount = 2, A_minValue = 1, A_maxValue = 100, 
A_nullCount = 0),
+          IndexRow("file_2", valueCount = 2, A_minValue = 101, A_maxValue = 
200, A_nullCount = 0)
+        ),
+        Seq("file_2")),
+      // Decimal arithmetic overflows into NULL instead (and throws in ANSI 
mode, which TryEval turns
+      // into NULL), so its steps are partial: an overflowing bound is NULL 
and keeps the file. The
+      // quotient below is decimal(38, 6), with 32 integer digits: the min 
maps to 1e18 and fits, the
+      // max (about 9.2e36) overflows, and dropping the file would lose the 
matching row 1
+      arguments(
+        "CAST(A AS DECIMAL(38,0)) / 0.000000000000000001BD > 0",
+        Seq(
+          IndexRow("file_1", valueCount = 2, A_minValue = 1, A_maxValue = 
Long.MaxValue, A_nullCount = 0)
+        ),
+        Seq("file_1")),
+      // A file whose bounds fit still prunes (file_1, max maps to 1e20 <= 
1e21), while file_2 overflows
+      arguments(
+        "CAST(A AS DECIMAL(38,0)) / 0.000000000000000001BD > 
1000000000000000000000BD",
+        Seq(
+          IndexRow("file_1", valueCount = 2, A_minValue = 1, A_maxValue = 100, 
A_nullCount = 0),
+          IndexRow("file_2", valueCount = 2, A_minValue = 1, A_maxValue = 
Long.MaxValue, A_nullCount = 0)
+        ),
+        Seq("file_2")),
+      // The product is bounded to decimal(38, 0), so the max (about 9.2e38) 
overflows
+      arguments(
+        "CAST(A AS DECIMAL(38,0)) * 100000000000000000000BD > 0",
+        Seq(
+          IndexRow("file_1", valueCount = 2, A_minValue = 1, A_maxValue = 
Long.MaxValue, A_nullCount = 0)
+        ),
+        Seq("file_1"))
+    )
+  }
 }
diff --git 
a/hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/hudi/TestHoodieCatalystExpressionUtils.scala
 
b/hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/hudi/TestHoodieCatalystExpressionUtils.scala
index db2d01a9b611..68e597b6516c 100644
--- 
a/hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/hudi/TestHoodieCatalystExpressionUtils.scala
+++ 
b/hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/hudi/TestHoodieCatalystExpressionUtils.scala
@@ -35,6 +35,7 @@ class TestHoodieCatalystExpressionUtils extends 
SparkAdapterSupport {
   private val intAttr = AttributeReference("i", IntegerType)()
   private val strAttr = AttributeReference("s", StringType)()
   private val dblAttr = AttributeReference("d", DoubleType)()
+  private val fltAttr = AttributeReference("f", FloatType)()
   private val dateAttr = AttributeReference("dt", DateType)()
   private val longAttr = AttributeReference("l", LongType)()
   private val decAttr = AttributeReference("dec", DecimalType(10, 2))()
@@ -53,6 +54,13 @@ class TestHoodieCatalystExpressionUtils extends 
SparkAdapterSupport {
     expr.collect { case attrRef: AttributeReference => attrRef }.distinct
       .find(attrRef => TermRange.derive(expr, 
ColumnStatsSource(Seq(attrRef.name))).isDefined)
 
+  /**
+   * Whether the range of `expr` over `attr` is guarded, i.e. a NULL bound 
means unknown and keeps the
+   * file; `None` if it has no range.
+   */
+  private def guarded(expr: Expression, attr: AttributeReference): 
Option[Boolean] =
+    TermRange.derive(expr, 
ColumnStatsSource(Seq(attr.name))).map(_.nullBoundIsUnknown)
+
   @Test
   def testIdentityAttributeMatches(): Unit = {
     assertEquals(Some(intAttr), matched(intAttr))
@@ -60,24 +68,54 @@ class TestHoodieCatalystExpressionUtils extends 
SparkAdapterSupport {
 
   @Test
   def testArithmeticTransformationsPreserveOrdering(): Unit = {
-    assertEquals(Some(intAttr), matched(Add(intAttr, Literal(1))))
-    assertEquals(Some(intAttr), matched(Add(Literal(1), intAttr)))
-    assertEquals(Some(intAttr), matched(Multiply(intAttr, Literal(2))))
-    assertEquals(Some(intAttr), matched(Multiply(Literal(2), intAttr)))
+    assertEquals(Some(dblAttr), matched(Add(dblAttr, Literal(1.0d))))
+    assertEquals(Some(dblAttr), matched(Add(Literal(1.0d), dblAttr)))
+    assertEquals(Some(dblAttr), matched(Multiply(dblAttr, Literal(2.0d))))
+    assertEquals(Some(dblAttr), matched(Multiply(Literal(2.0d), dblAttr)))
     assertEquals(Some(intAttr), matched(Divide(intAttr, Literal(2))))
     assertEquals(Some(intAttr), matched(BitwiseOr(intAttr, Literal(1))))
     assertEquals(Some(intAttr), matched(BitwiseOr(Literal(1), intAttr)))
-    assertEquals(Some(intAttr), matched(ShiftLeft(intAttr, Literal(1))))
+  }
+
+  @Test
+  def testOverflowingArithmeticIsGuarded(): Unit = {
+    // Integral results wrap around on overflow in non-ANSI mode (for ex, 
Long.MaxValue * 2 = -2), so
+    // the range is guarded per file on not overflowing.
+    assertEquals(Some(true), guarded(Add(intAttr, Literal(1)), intAttr))
+    assertEquals(Some(true), guarded(Add(Literal(-1), intAttr), intAttr))
+    assertEquals(Some(true), guarded(Add(longAttr, Literal(1L)), longAttr))
+    assertEquals(Some(true), guarded(Multiply(intAttr, Literal(2)), intAttr))
+    assertEquals(Some(true), guarded(Multiply(Literal(2L), longAttr), 
longAttr))
+    assertEquals(Some(true), guarded(ShiftLeft(intAttr, Literal(1)), intAttr))
+    assertEquals(Some(true), guarded(ShiftLeft(longAttr, Literal(65)), 
longAttr))
+    // The other operand must still be constant, and an integral factor 
positive.
+    assertEquals(None, guarded(Add(intAttr, Rand(Literal(0L))), intAttr))
+    assertEquals(None, guarded(Multiply(intAttr, Literal(-2)), intAttr))
+    assertEquals(None, guarded(Multiply(intAttr, Literal(0)), intAttr))
+    assertEquals(None, guarded(ShiftLeft(intAttr, intAttr), intAttr))
+    // An unresolved constant outside the result type has no limits within it.
+    assertEquals(None, guarded(Add(intAttr, Literal(Long.MaxValue)), intAttr))
+    assertEquals(None, guarded(Multiply(intAttr, Literal(Long.MaxValue)), 
intAttr))
+    // Decimal results overflow into NULL (or throw in ANSI mode), so the 
range is partial: a NULL
+    // bound is unknown and keeps the file. A float / double quotient 
saturates instead.
+    assertEquals(Some(true), guarded(Add(decAttr, Literal(Decimal(1), 
DecimalType(10, 2))), decAttr))
+    assertEquals(Some(true), guarded(Multiply(decAttr, Literal(Decimal(2), 
DecimalType(10, 2))), decAttr))
+    assertEquals(Some(true), guarded(Divide(decAttr, Literal(Decimal(2), 
DecimalType(10, 2))), decAttr))
+    assertEquals(Some(false), guarded(Divide(dblAttr, Literal(2.0d)), dblAttr))
+    // Float and double results saturate to infinity instead, keeping the 
ordering without a guard.
+    assertEquals(Some(false), guarded(Add(fltAttr, Literal(1.0f)), fltAttr))
+    assertEquals(Some(false), guarded(Multiply(Literal(2.0f), fltAttr), 
fltAttr))
+    assertEquals(Some(false), guarded(Add(Cast(longAttr, DoubleType), 
Literal(1.0d)), longAttr))
   }
 
   @Test
   def testMultiplyDivideRequirePositiveLiteralFactor(): Unit = {
     // Negative factors reverse ordering.
     assertEquals(None, matched(Multiply(dblAttr, Literal(-1.0d))))
-    assertEquals(None, matched(Multiply(Literal(-1), intAttr)))
+    assertEquals(None, matched(Multiply(Literal(-1.0d), dblAttr)))
     assertEquals(None, matched(Divide(dblAttr, Literal(Decimal(-2), 
DecimalType(1, 0)))))
     // Zero collapses ordering and makes division undefined.
-    assertEquals(None, matched(Multiply(intAttr, Literal(0L))))
+    assertEquals(None, matched(Multiply(dblAttr, Literal(0.0d))))
     assertEquals(None, matched(Divide(dblAttr, Literal(0.0d))))
     // NaN fails the positive check; typed null literals carry a null value.
     assertEquals(None, matched(Multiply(dblAttr, Literal(Double.NaN))))
@@ -85,13 +123,13 @@ class TestHoodieCatalystExpressionUtils extends 
SparkAdapterSupport {
     assertEquals(None, matched(Multiply(dblAttr, 
Literal(Double.PositiveInfinity))))
     assertEquals(None, matched(Multiply(Literal(Float.PositiveInfinity), 
dblAttr)))
     assertEquals(None, matched(Divide(dblAttr, 
Literal(Double.PositiveInfinity))))
-    assertEquals(None, matched(Multiply(intAttr, Literal(null, IntegerType))))
+    assertEquals(None, matched(Multiply(dblAttr, Literal(null, DoubleType))))
     // Non-literal factors are not matched, even when reference-free or the 
column itself.
-    assertEquals(None, matched(Multiply(intAttr, Add(Literal(1), Literal(1)))))
-    assertEquals(None, matched(Multiply(intAttr, intAttr)))
+    assertEquals(None, matched(Multiply(dblAttr, Add(Literal(1.0d), 
Literal(1.0d)))))
+    assertEquals(None, matched(Multiply(dblAttr, dblAttr)))
     // Strictly positive literals of any numeric type match in the supported 
operand positions.
     assertEquals(Some(dblAttr), matched(Multiply(dblAttr, Literal(2.5d))))
-    assertEquals(Some(longAttr), matched(Multiply(Literal(3L), longAttr)))
+    assertEquals(Some(fltAttr), matched(Multiply(Literal(3.0f), fltAttr)))
     assertEquals(Some(dblAttr), matched(Divide(dblAttr, Literal(Decimal(2), 
DecimalType(1, 0)))))
   }
 
@@ -100,10 +138,18 @@ class TestHoodieCatalystExpressionUtils extends 
SparkAdapterSupport {
     // A + A * -2 = -A reverses ordering, so an operand referencing the column 
must not match.
     assertEquals(None, matched(Add(dblAttr, Multiply(dblAttr, 
Literal(-2.0d)))))
     assertEquals(None, matched(Add(Multiply(dblAttr, Literal(-2.0d)), 
dblAttr)))
-    assertEquals(None, matched(Add(intAttr, intAttr)))
+    assertEquals(None, matched(Add(dblAttr, dblAttr)))
     // Data skipping re-evaluates the operand against the min/max bounds, so 
it must be a constant.
     assertEquals(None, matched(Add(dblAttr, Rand(Literal(0L)))))
     assertEquals(None, matched(Add(Rand(Literal(0L)), dblAttr)))
+    // An infinite addend maps the opposite infinity to NaN (-Infinity + 
Infinity), which sorts above
+    // every number; a NaN or null addend is not finite either.
+    assertEquals(None, matched(Add(dblAttr, Literal(Double.PositiveInfinity))))
+    assertEquals(None, matched(Add(Literal(Float.NegativeInfinity), fltAttr)))
+    assertEquals(None, matched(Add(dblAttr, Literal(Double.NaN))))
+    assertEquals(None, matched(Add(dblAttr, Literal(null, DoubleType))))
+    // A foldable addend is evaluated, as the optimizer would fold it into a 
literal.
+    assertEquals(Some(dblAttr), matched(Add(dblAttr, Add(Literal(1.0d), 
Literal(2.0d)))))
   }
 
   @Test
@@ -320,7 +366,7 @@ class TestHoodieCatalystExpressionUtils extends 
SparkAdapterSupport {
 
   @Test
   def testNestedComposition(): Unit = {
-    assertEquals(Some(intAttr), matched(Add(Multiply(intAttr, Literal(2)), 
Literal(3))))
+    assertEquals(Some(dblAttr), matched(Add(Multiply(dblAttr, Literal(2.0d)), 
Literal(3.0d))))
   }
 
   @Test

Reply via email to