Abhinav-Agarwal021 commented on PR #13529: URL: https://github.com/apache/gluten/pull/13529#issuecomment-6944453611
Thanks @rdtr for this, the general rule is the right direction. One case I think it misses: try_sum on integral input with session ANSI off. capturedAnsiMode maps Sum to evalMode == ANSI , so try_sum (TRY) is treated the same as LEGACY. For integral input those two differ on overflow: • Spark try_sum : returns NULL • Velox sum with spark.ansi_enabled=false : wraps around So with session ANSI off there's no mismatch, the aggregate stays native, and the result differs from Spark. Hash aggregate is protected by the existing try_sum check in HashAggregateExecBaseTransformer.checkAggFuncModeSupport , but I couldn't find an equivalent for window aggregates. Example: SET spark.sql.ansi.enabled=false; SELECT k, try_sum(l) OVER (PARTITION BY k) FROM VALUES (1, 9223372036854775807L), (1, 1L) AS t(k, l); -- Spark: NULL; Velox (if offloaded): -9223372036854775808 Suggestion: compare the full EvalMode for Sum / Average . Velox matches Spark only for ANSI with session ANSI on, and for LEGACY (or TRY on decimal input, which also returns NULL) with session ANSI off. Everything else falls back. Happy to send a patch or tests if that helps. Am I missing a guard on the window path? -- 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]
