philo-he commented on code in PR #12192:
URL: https://github.com/apache/gluten/pull/12192#discussion_r3593039331
##########
gluten-substrait/src/main/scala/org/apache/gluten/expression/ExpressionConverter.scala:
##########
@@ -642,18 +642,50 @@ object ExpressionConverter extends SQLConfHelper with
Logging {
substraitExprName,
expr.children.map(replaceWithExpressionTransformer0(_, attributeSeq,
expressionsMap)),
expr)
- case CheckOverflow(b: BinaryArithmetic, decimalType, _)
+ case CheckOverflow(b: BinaryArithmetic, decimalType, nullOnOverflow)
if !BackendsApiManager.getSettings.transformCheckOverflow &&
DecimalArithmeticUtil.isDecimalArithmetic(b) =>
- val arithmeticExprName =
+ val baseExprName =
BackendsApiManager.getSparkPlanExecApiInstance.getDecimalArithmeticExprName(
getAndCheckSubstraitName(b, expressionsMap),
SparkShimLoader.getSparkShims.decimalAllowPrecisionLoss(b))
+ // When nullOnOverflow is false, it's ANSI mode - use checked_ prefix
for overflow errors
+ val arithmeticExprName = if (!nullOnOverflow) {
+ "checked_" + baseExprName
Review Comment:
Do we need to add guard logic to allow Add, Subtract, and Multiply only?
##########
gluten-substrait/src/main/scala/org/apache/gluten/expression/ExpressionConverter.scala:
##########
@@ -642,18 +642,50 @@ object ExpressionConverter extends SQLConfHelper with
Logging {
substraitExprName,
expr.children.map(replaceWithExpressionTransformer0(_, attributeSeq,
expressionsMap)),
expr)
- case CheckOverflow(b: BinaryArithmetic, decimalType, _)
+ case CheckOverflow(b: BinaryArithmetic, decimalType, nullOnOverflow)
if !BackendsApiManager.getSettings.transformCheckOverflow &&
DecimalArithmeticUtil.isDecimalArithmetic(b) =>
- val arithmeticExprName =
+ val baseExprName =
BackendsApiManager.getSparkPlanExecApiInstance.getDecimalArithmeticExprName(
getAndCheckSubstraitName(b, expressionsMap),
SparkShimLoader.getSparkShims.decimalAllowPrecisionLoss(b))
+ // When nullOnOverflow is false, it's ANSI mode - use checked_ prefix
for overflow errors
+ val arithmeticExprName = if (!nullOnOverflow) {
+ "checked_" + baseExprName
+ } else {
+ baseExprName
Review Comment:
My concern is, the above code is Velox-sepcific, so it may affect ClickHouse
backend (though no failure in the existing tests). Could we move it to backend
API `getDecimalArithmeticExprName`?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]