wud-if opened a new issue, #13411: URL: https://github.com/apache/gluten/issues/13411
**Description**: ### Motivation The Flink arithmetic expressions — `ABS`, unary minus (`-x`), `FLOOR`, `CEIL` and `ROUND` — are core building blocks of Flink SQL. Today gluten-flink does not map them, so any Calc projecting them fails function offload (`Function not supported`) and stays on the native path. ### Proposal Offload them to the velox flinksql function set: - **velox side** (companion PR): Flink-semantics implementations under `velox/functions/flinksql/` — `ROUND` follows Flink's decimal-representation HALF_UP (`BigDecimal.valueOf(...).setScale(d, HALF_UP)`, so `ROUND(28.05, 1) = 28.1`), `FLOOR`/`CEIL` over decimals map `decimal(p, s) -> decimal(p, 0)` (Flink's DecimalScale0TypeStrategy), and `ABS`/`negate` mirror Java `Math.abs`/`-x` exactly, including `-0.0 -> +0.0` and the minimum-integer wrap-around. - **planner side** (this repo): `ABS`/`FLOOR`/`CEIL`/`CEILING`/`ROUND` name mappings; a one-operand `"-"` (Calcite emits Flink's unary minus as a single-operand `"-"` RexCall) resolves to `negate` against the binary subtract candidates via `isSuitable`; `ROUND` over decimals emits a same-typed round call wrapped in a cast to Flink's inferred round type (the narrowed scale is value-dependent, not expressible in a velox signature). - Semantics to preserve: HALF_UP away from zero for negative values and ties, integer negative scales, decimal precision/scale rules, and null propagation. (This issue was drafted with AI assistance.) **Gluten version**: main branch (gluten-flink) -- 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]
