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 "Quanlong Huang (Jira)" <ji...@apache.org> on 2023/01/05 07:09:00 UTC

[jira] [Created] (IMPALA-11824) View that cast column to the same type cannot be used

Quanlong Huang created IMPALA-11824:
---------------------------------------

             Summary: View that cast column to the same type cannot be used
                 Key: IMPALA-11824
                 URL: https://issues.apache.org/jira/browse/IMPALA-11824
             Project: IMPALA
          Issue Type: Bug
          Components: Frontend
            Reporter: Quanlong Huang


I found this when debugging for another issue. For views that cast columns to the same types, any usage of it will failed with "Could not resolve column/field reference" error. Here's an example:
{code:java}
create table t (id int) stored as textfile;
insert into t select 1;

create view v(id) as select cast(id as int) from t;
select * from v;
ERROR: AnalysisException: Could not resolve column/field reference: 'v._c0'

select id from v;
ERROR: AnalysisException: Could not resolve column/field reference: 'v._c0'

# Casting id to a different type works
create view v2(id) as select cast(id as tinyint) from t;
+----+
| id |
+----+
| 1  |
+----+

# Don't specifying the view column names also works
create view v3 as select cast(id as tinyint) from t;
+-----+
| _c0 |
+-----+
| 1   |
+-----+{code}



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

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