You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@impala.apache.org by "Aleksandr Efimov (Jira)" <ji...@apache.org> on 2026/08/25 23:47:00 UTC
[jira] [Created] (IMPALA-15301) Calcite planner: export Impala's explicit cast as a Substrait cast
Aleksandr Efimov created IMPALA-15301:
-----------------------------------------
Summary: Calcite planner: export Impala's explicit cast as a Substrait cast
Key: IMPALA-15301
URL: https://issues.apache.org/jira/browse/IMPALA-15301
Project: IMPALA
Issue Type: Sub-task
Components: Frontend
Reporter: Aleksandr Efimov
ImpalaOperatorTable rewrites cast into an operator of its own, named EXPLICIT_CAST and carrying SqlKind.OTHER, to keep Calcite from folding it. The converter Isthmus already has for SqlKind.CAST therefore never sees it, and every explicit cast stops the export. Over the TPC-DS queries that carry Calcite goldens this is what blocks seven of them.
Add a call converter that emits a Substrait Cast, the same way IMPALA-15298 handles IF.
The failure behaviour is the closest of the two Substrait offers rather than an exact match, and this is worth stating plainly. Measured against a running Impala: casting an unparseable string returns NULL, and an integer that does not fit wraps round silently, so 99999999999 cast to int comes back as 1215752191. Impala never raises. RETURN_NULL states the first half. There is no Substrait failure behaviour for the second, so a consumer would produce NULL where Impala produces the wrapped value.
Almost every EXPLICIT_CAST in a plan is one the planner inserted to line types up, where nothing overflows. A narrowing cast a user wrote is a real difference, and the alternative is not exporting any plan that contains a cast at all.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)