Yida Wu created IMPALA-13786:
--------------------------------

             Summary: 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


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}





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

Reply via email to