hudi-agent commented on code in PR #19475:
URL: https://github.com/apache/hudi/pull/19475#discussion_r3702484205
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/spark/sql/BaseHoodieCatalystExpressionUtils.scala:
##########
@@ -110,5 +110,24 @@ abstract class BaseHoodieCatalystExpressionUtils extends
HoodieCatalystExpressio
}
}
}
+
+ // Multiplying or dividing by a constant preserves ordering only when the
constant is a
+ // strictly positive numeric literal: negative factors reverse the
ordering, zero collapses
+ // it (and makes division undefined), and non-literal operands cannot be
validated
+ // statically (the optimizer folds constant factors to literals before
data skipping runs).
+ // Typed null literals carry a null value and fail the value match
+ private def isPositiveNumericLiteral(expr: Expression): Boolean = expr
match {
+ case Literal(value, _) => value match {
Review Comment:
🤖 nit: the block comment above could be trimmed — the method name already
says "positive numeric literal", and the `case _ => false` arm makes the
null/non-literal behavior self-evident. The most non-obvious part (why
non-literals are excluded) could stand on its own as a one-liner: `//
non-literal operands can't be evaluated statically; the optimizer folds
constant expressions before data skipping runs`.
<sub><i>⚠️ AI-generated; verify before applying. React 👍/👎 to flag
quality.</i></sub>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]