You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@auron.apache.org by "weiqingy (via GitHub)" <gi...@apache.org> on 2026/06/03 17:14:01 UTC

[PR] [AURON #1864] Convert Cast operators to native operators [auron]

weiqingy opened a new pull request, #2303:
URL: https://github.com/apache/auron/pull/2303

   # Which issue does this PR close?
   
   Closes #1864
   
   # Rationale for this change
   
   Flink SQL `CAST(x AS T)` is strict — it must error on a bad conversion (overflow, unparseable string) — while `TRY_CAST(x AS T)` returns NULL. The Flink converter previously routed explicit `CAST` to the native try-cast node, so a failing `CAST` silently returned NULL instead of erroring, changing query semantics under native acceleration. It also accepted every cast unconditionally, with no source→target type validation, even though the native cast kernels do not faithfully cover every type pair.
   
   This PR makes cast conversion faithful to Flink semantics and safe against kernel mismatches: strict `CAST` errors, `TRY_CAST` nulls, and conversions outside a conservative supported set fall back to Flink's engine.
   
   # What changes are included in this PR?
   
   Commit 1 — gate cast type support and convert `TRY_CAST`:
   - Add a source→target type gate (`isCastTypeSupported`) so only numeric↔numeric, numeric→string, string→numeric, and boolean↔string conversions convert natively; everything else (temporal, complex, etc.) falls back to Flink.
   - Support explicit `TRY_CAST`, matched by operator identity (`FlinkSqlOperatorTable.TRY_CAST`) since its `SqlKind` is `OTHER_FUNCTION`, routing it to the native try-cast node (NULL on failure).
   
   Commit 2 — route explicit `CAST` to the strict native cast node:
   - Add `wrapInCast` / `buildCast` and route explicit `CAST` to the strict `PhysicalCastNode` (errors on failure), where it previously used the try-cast node.
   - Internal widening promotions (arithmetic, comparison, CASE) are unchanged and still use try-cast — widening never fails, so try-cast is correct there.
   
   No protobuf, native-engine, or dependency changes — both cast nodes already exist.
   
   # Are there any user-facing changes?
   
   Yes. Flink SQL `CAST` now executes with strict (error-on-failure) semantics natively, matching Flink, and `TRY_CAST` executes with null-on-failure semantics. Casts to currently-unsupported types transparently fall back to Flink's engine and produce the same results as before.
   
   # How was this patch tested?
   
   Unit tests in `RexCallConverterTest` cover strict `CAST` (strict node), `TRY_CAST` (try node), the supported-type pairs, and unsupported pairs that fall back. End-to-end SQL tests in `AuronFlinkCalcITCase` run `CAST` and `TRY_CAST` queries (including a non-parseable string under `TRY_CAST` yielding NULL) and a cast-to-unsupported-type query that falls back, all asserting the native row-set. Full `auron-flink-planner` module suite passes (117 tests) with 0 Checkstyle violations.
   


-- 
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: commits-unsubscribe@auron.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [AURON #1864] Convert Cast operators to native operators [auron]

Posted by "weiqingy (via GitHub)" <gi...@apache.org>.
weiqingy commented on PR #2303:
URL: https://github.com/apache/auron/pull/2303#issuecomment-4615205487

   Hi @Tartarus0zm, could you review this PR when you get a chance? Thank you!
   
   In short: explicit CAST now routes to the strict native cast node (errors on failure, matching Flink), TRY_CAST routes to the try node (null on failure), and unsupported source→target type pairs fall back to Flink. No proto or dependency changes.
   
   I also opened #2304 to track follow-up end-to-end IT coverage for composed predicates/expressions across the merged Wave-1 converters — out of scope here, but captured so it isn't lost.


-- 
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: commits-unsubscribe@auron.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [AURON #1864] Convert Cast operators to native operators [auron]

Posted by "weiqingy (via GitHub)" <gi...@apache.org>.
weiqingy commented on PR #2303:
URL: https://github.com/apache/auron/pull/2303#issuecomment-4615200544

   Hi @Tartarus0zm, could you review this PR when you get a chance? Thank you!
   
   In short: explicit `CAST` now routes to the strict native cast node (errors on failure, matching Flink), `TRY_CAST` routes to the try node (null on failure), and unsupported source→target type pairs fall back to Flink. No proto or dependency changes.
   
   I also opened #2304 to track follow-up end-to-end IT coverage for composed predicates/expressions across the merged Wave-1 converters — out of scope here, but captured so it isn't lost.
   


-- 
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: commits-unsubscribe@auron.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [AURON #1864] Convert Cast operators to native operators [auron]

Posted by "Tartarus0zm (via GitHub)" <gi...@apache.org>.
Tartarus0zm merged PR #2303:
URL: https://github.com/apache/auron/pull/2303


-- 
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: commits-unsubscribe@auron.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org