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


##########
cpp/velox/substrait/SubstraitToVeloxPlanValidator.cc:
##########
@@ -141,17 +141,30 @@ bool 
SubstraitToVeloxPlanValidator::flattenDualLevel(const TypePtr& type, std::v
 
 bool SubstraitToVeloxPlanValidator::validateRound(
     const ::substrait::Expression::ScalarFunction& scalarFunction,
-    const RowTypePtr& inputType) {
+    const std::vector<core::TypedExprPtr>& params) {
   const auto& arguments = scalarFunction.arguments();
   if (arguments.size() < 2) {
     return false;
   }
+  if (params.empty() || !params[0]) {
+    LOG_VALIDATION_MSG("Round value expression is unavailable.");
+    return false;
+  }
 
   if (!arguments[1].value().has_literal()) {
     LOG_VALIDATION_MSG("Round scale is expected.");

Review Comment:
   Addressed in the rebased, signed head 
https://github.com/luis4a0/gluten/commit/5b4edb79a. Native validation now 
reports `Round scale must be a literal integer for native execution.` A 
public-path regression passes a nonliteral scale field, verifies fallback, and 
asserts the diagnostic. The native function binary passes 25/25 and 
`VeloxIntegralRoundSuite` passes 2/2.



##########
cpp/velox/tests/SparkFunctionTest.cc:
##########
@@ -125,6 +126,88 @@ TEST_F(SparkFunctionTest, roundWithDecimal) {
   runRoundWithDecimalTest<int8_t>(testRoundWithDecIntegralData<int8_t>());
 }
 
+TEST_F(SparkFunctionTest, integralRoundUsesSessionAnsi) {
+  const auto input = makeRowVector({makeNullableFlatVector<int8_t>({127, -128, 
25, -25, std::nullopt})});
+  for (const auto ansi : {false, true}) {
+    queryCtx_->testingOverrideConfigUnsafe({{sparkAnsiEnabledConfigKey(), ansi 
? "true" : "false"}});
+    const auto expression = "round(c0, cast(-1 as integer))";
+    if (ansi) {
+      VELOX_ASSERT_USER_THROW(evaluate(expression, input), "Arithmetic 
overflow: round(");

Review Comment:
   I retained this assertion intentionally. Gluten `AGENTS.md` requires tests 
to assert informative error-message text rather than only exception types or 
categories. The focused prefix `Arithmetic overflow: round(` checks the stable 
actionable diagnosis without binding dynamic values. The native function binary 
passes 25/25 on the rebased head 
https://github.com/luis4a0/gluten/commit/5b4edb79a.



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