luis4a0 commented on code in PR #13103:
URL: https://github.com/apache/gluten/pull/13103#discussion_r4573392051


##########
cpp/velox/substrait/SubstraitToVeloxPlanValidator.cc:
##########
@@ -152,6 +152,19 @@ bool SubstraitToVeloxPlanValidator::validateRound(
     return false;
   }
 
+  const auto& valueType = params[0]->type();
+  if (valueType->isDecimal()) {
+    const auto& scale = arguments[1].value().literal();
+    if (scale.has_null() && scale.null().has_i32()) {
+      return true;
+    }
+    if (scale.has_i32() && scale.i32() >= -400 && scale.i32() <= 400) {

Review Comment:
   Implemented in verified head 
https://github.com/luis4a0/gluten/commit/7230fd279d2496ebafb475e7e41da13b10f82274.
 The conservative `[-400, 400]` bound is removed. Native validation now accepts 
all foldable INTEGER scales and NULL except `INT_MIN` and `INT_MIN + 1`. 
Official Spark 4.1.1 probes show those two scales resolve overflowed 
`DECIMAL(3,0)` metadata for a `DECIMAL(3,1)` input, while Velox correctly 
expects `DECIMAL(38,0)`, so only those endpoints retain Spark fallback. Tests 
cover accepted `INT_MIN + 2`, ±401, `INT_MAX`, NULL, and both excluded 
endpoints.



-- 
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]

Reply via email to