[ 
https://issues.apache.org/jira/browse/IMPALA-13786?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Yida Wu updated IMPALA-13786:
-----------------------------
    Description: 
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}



  was:
IMPALA-10836 introduced the SimplifyCastExprRule optimization to simplify CAST 
expressions. However, in certain cases involving VARCHAR, 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}




> 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