Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
Impala 3.0
-
None
-
None
-
ghx-label-7
Description
Consider this SQL statement:
SELECT 1 + CAST('123' AS SMALLINT) FROM alltypestiny
This runs as expected and produces the value of 124 as an INT as expected.
Now consider this version:
SELECT 1 + CAST('ABC' AS SMALLINT) FROM alltypestiny
This version analyzes OK. The analyzer detects that the cast is invalid and leaves the AST in its original form. However, the analyzer sets the type of the expression to SMALLINT rather than the proper INT.
(Impala uses conservative type propagation rules: if either operand of addition is SMALLINT, the result should be INT.)
Would have expected the analyzer to either:
- Fail the query when it detected the cast failure, or
- Leave the AST unchanged and leave the expression type unchanged at INT