[ 
https://issues.apache.org/jira/browse/IMPALA-13786?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17931143#comment-17931143
 ] 

ASF subversion and git services commented on IMPALA-13786:
----------------------------------------------------------

Commit f59c0917fe382f675c6fa0f55e9b84791db579e5 in impala's branch 
refs/heads/master from Riza Suminto
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=f59c0917f ]

IMPALA-13786: Skip rewriting expr of Hive auto-generated label

IMPALA-10836 introduced the SimplifyCastExprRule optimization to
simplify CAST expressions. However, applying this rewrite rule over
expression referred by Hive auto-generated label has caused
AnalysisException like following:

AnalysisException: Could not resolve column/field reference:
'failing_view._c0'

It is most likely that, before IMPALA-10836, expression referred by Hive
auto-generated label never effectively being rewritten. Thus, the
ExprSubstitutionMap across multiple InlineViewRef was intact.

This patch attempt to fix the issue by making any expression in
SelectList that mapped to Hive auto-generated label ineligible for any
kind of expression rewrite.

Also addressed some flake8 errors in test_views_compatibility.py.

Testing:
- Add test case in views-compatibility.test.
- Break test_view_compatibility_hive into 3 separate tests.
- Refactor test_views_compatibility.py to run both EXPLAIN and SELECT
  query over the test view.
- Pass test_views_compatibility.py in exhaustive exploration.
- Pass core tests.

Change-Id: I4b8bbd0afd6da0532bf2ef460989d4f01337d198
Reviewed-on: http://gerrit.cloudera.org:8080/22546
Reviewed-by: Impala Public Jenkins <impala-public-jenk...@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenk...@cloudera.com>


> Simple rewrite of cast expression may fail in certain VARCHAR cases
> -------------------------------------------------------------------
>
>                 Key: IMPALA-13786
>                 URL: https://issues.apache.org/jira/browse/IMPALA-13786
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Frontend
>            Reporter: Yida Wu
>            Assignee: Riza Suminto
>            Priority: Critical
>
> IMPALA-10836 introduced the SimplifyCastExprRule optimization to simplify 
> CAST expressions. However, in certain cases involving VARCHAR and column 
> alias, this rule may cause failures during the analysis phase like below:
> {code:java}
> CREATE VIEW failing_view(`123456`) AS  
> SELECT  
>   CAST(`123456` AS VARCHAR(5))  
> FROM  
>   (  
>     SELECT  
>       CAST(`123456` AS VARCHAR(5)) `123456`  
>     FROM  
>       (  
>         SELECT  
>           "text" AS `123456`  
>       ) b  
>   ) a;
> SELECT * FROM failing_view;
> Expected:
> +--------+  
> | 123456 |  
> +--------+  
> | text   |  
> +--------+  
> Actual Result:
> ERROR: Query failed:  
> AnalysisException: An error occurred after query rewrite: Could not resolve 
> column/field reference: 'failing_view._c0'  
> CAUSED BY: AnalysisException: Could not resolve column/field reference: 
> 'failing_view._c0'  
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscr...@impala.apache.org
For additional commands, e-mail: issues-all-h...@impala.apache.org

Reply via email to