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

Ashutosh Bapat commented on HIVE-21745:
---------------------------------------

I verified that this is not reproducible on the HEAD. Attached is repro.sql 
which has the same commands as the description plus the version string of hive 
at the beginning. The select commands run without any error. Please see the 
output in repro.out.

> Change in join order causes query parse to fail
> -----------------------------------------------
>
>                 Key: HIVE-21745
>                 URL: https://issues.apache.org/jira/browse/HIVE-21745
>             Project: Hive
>          Issue Type: Bug
>          Components: Hive
>    Affects Versions: 1.1.0
>            Reporter: Andre Araujo
>            Priority: Major
>
> I ran into the following case, where a query fails to parse if the join order 
> is changed:
> {code}
> create database if not exists test;
> drop table if exists test.table1;
> create table test.table1 (
>   id string,
>   col_a string
> )
> stored as textfile;
> drop table if exists test.table2;
> create table test.table2 (
>   id string
> )
> stored as textfile;
> drop table if exists test.table3;
> create table test.table3 (
>   col_a string,
>   col_b string
> )
> stored as textfile;
> drop table if exists test.table4;
> create table test.table4 (
>   id string
> )
> stored as textfile;
> -- This fails with: Invalid table alias or column reference 't3': (possible 
> column names are: id, col_a)
> select
>   1
> from
>   test.table1 as t1
>   left join test.table2 as t2 on t2.id = t1.id
>   left join test.table3 as t3 on t1.col_a = t3.col_a
>   left join test.table4 as t4 on t1.id = t4.id and t3.col_b = 'X'
> ;
> -- This works
> select
>   1
> from
>   test.table1 as t1
>   left join test.table3 as t3 on t1.col_a = t3.col_a
>   left join test.table4 as t4 on t1.id = t4.id and t3.col_b = 'X'
>   left join test.table2 as t2 on t2.id = t1.id
> ;
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to