Paul Rogers created IMPALA-7890:
-----------------------------------
Summary: Wrong expression type for addition with invalid cast
Key: IMPALA-7890
URL: https://issues.apache.org/jira/browse/IMPALA-7890
Project: IMPALA
Issue Type: Bug
Components: Frontend
Affects Versions: Impala 3.0
Reporter: Paul Rogers
Assignee: Paul Rogers
Consider this SQL statement:
{code:sql}
SELECT 1 + CAST('123' AS SMALLINT) FROM alltypestiny
{code}
This runs as expected and produces the value of 124 as an INT as expected.
Now consider this version:
{code:sql}
SELECT 1 + CAST('ABC' AS SMALLINT) FROM alltypestiny
{code}
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}}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]