You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "Alice Fan (Jira)" <ji...@apache.org> on 2019/11/20 00:13:00 UTC
[jira] [Created] (IMPALA-9173) Impala should return compatible type
expression when ENABLE_EXPR_REWRITES is true
Alice Fan created IMPALA-9173:
---------------------------------
Summary: Impala should return compatible type expression when ENABLE_EXPR_REWRITES is true
Key: IMPALA-9173
URL: https://issues.apache.org/jira/browse/IMPALA-9173
Project: IMPALA
Issue Type: Bug
Components: Frontend
Affects Versions: Impala 3.4.0
Reporter: Alice Fan
*Reproduce Steps:*
{code:java}
// By default, ENABLE_EXPR_REWRITES query option is set to True.
[localhost:21000] default> set ENABLE_EXPR_REWRITES=true;
[localhost:21000] default> select typeof(case when 1 = 1 then string_col else timestamp_col end) from functional.alltypes limit 1;
+----------------------------------------------------------------+
| typeof(case when 1 = 1 then string_col else timestamp_col end) |
+----------------------------------------------------------------+
| STRING |
+----------------------------------------------------------------+
[localhost:21000] default> set ENABLE_EXPR_REWRITES=false;
[localhost:21000] default> select typeof(case when 1 = 1 then string_col else timestamp_col end) from functional.alltypes limit 1;
+----------------------------------------------------------------+
| typeof(case when 1 = 1 then string_col else timestamp_col end) |
+----------------------------------------------------------------+
| TIMESTAMP |
+----------------------------------------------------------------+
{code}
*What is the issue?*
In the above example, Impala should return string_col and cast it to timestamp type. Because timestamp is the most compatible type in the case (according to getCompatibleType() in Analyzer). In this example, we get the incorrect result when ENABLE_EXPR_REWRITES is set to true, but get correct result when it is set to false.
*What I found:*
If we enable expression rewrite, the query will trigger Simplify Conditionals expression rewrite rule and I can see that the result expression had successfully been casted to timestamp type while the first time do the analyze. But somehow, the cast will be dropped when re-analyze is happening.
This is a bug I found when I am working on IMPALA-9023 and I didn't find the root cause for this. I would like to share my findings and mark this as a known issue here. We could use the jira to track updates.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org