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

ASF GitHub Bot updated HIVE-26493:
----------------------------------
    Labels: pull-request-available  (was: )

> Hive throws error when querying a view that was created successfully
> --------------------------------------------------------------------
>
>                 Key: HIVE-26493
>                 URL: https://issues.apache.org/jira/browse/HIVE-26493
>             Project: Hive
>          Issue Type: Bug
>            Reporter: László Végh
>            Assignee: Dayakar M
>            Priority: Major
>              Labels: pull-request-available
>
> Steps to reproduce:
> 1. Create table tbl_x
> {noformat}
> create table tbl_x (a int, b string); {noformat}
> 2. Insert data in the table
> {noformat}
> insert into tbl_x values (1, 'Prince'); insert into tbl_x values (2, 'John'); 
> {noformat}
> 3. view data in table :
> {noformat}
> select * from tbl_x;
> +----------+----------+ 
> |tbl_x.a   |tbl_x.b   | 
> +----------+----------+ 
> |1         |Prince    | 
> |2         | John     |{noformat}
> 4. Create view:
> {noformat}
> create view vw_x (b) as (select a from tbl_x);{noformat}
> 5. Try to read data from view:
> {noformat}
> Error while compiling statement: FAILED: SemanticException line 1:67 cannot 
> recognize input near ')' 'vw_x' '<EOF>' in subquery source in definition of V 
> IEW vw_x [ SELECT `a` AS `b` FROM ((select `tbl_x`.`a` from 
> `default`.`tbl_x`)) `vw_x` ] used as vw_x at Line 1:14 
> (state=42000,code=40000) {noformat}
> 6. Drop the view
> {noformat}
> drop view vw_x; {noformat}
> 7. Create the view again with the below definition:
> {noformat}
> create view vw_x (b) as select a from tbl_x; {noformat}
> 8. Try to read the data from view:
> {noformat}
> select * from vw_x;
> +---------+ 
> | vw_x.b  | 
> +---------+ 
> | 1       | 
> | 2       | 
> +---------+ {noformat}



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

Reply via email to