Copilot commented on code in PR #13202:
URL: https://github.com/apache/gluten/pull/13202#discussion_r4190651850


##########
gluten-substrait/src/main/java/org/apache/gluten/substrait/expression/WindowFunctionNode.java:
##########
@@ -72,6 +73,23 @@ public class WindowFunctionNode implements Serializable {
     this.originalInputAttributes = originalInputAttributes;
   }
 
+  // A bound that does not parse as a long, such as the -1.50 of RANGE BETWEEN 
1.5 PRECEDING on a
+  // decimal key, throws GlutenNotSupportException so the window falls back; a
+  // NumberFormatException would fail the query instead.
+  private static Long 
parseOffset(org.apache.spark.sql.catalyst.expressions.Expression boundType) {
+    String raw = String.valueOf(boundType.eval(null));
+    try {
+      return Long.parseLong(raw);
+    } catch (NumberFormatException e) {
+      throw new GlutenNotSupportException(

Review Comment:
   This only converts the parsing failure into a fallback while Substrait 
serialization runs during validation. When 
`spark.gluten.sql.enable.native.validation=false`, `doNativeValidation` skips 
`PlanBuilder.makePlan`, so the ClickHouse backend still accepts the window; 
`parseOffset` then throws during the real plan serialization and the query 
fails rather than falling back. The new ClickHouse test masks this by 
overriding the suite’s `false` setting to `true`. Please reject non-parseable 
foldable bounds in ClickHouse’s JVM-side `supportWindowExec` (while preserving 
currently accepted values such as `decimal(10,0)`) so fallback does not depend 
on native validation.



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