You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Kryvenko Igor (JIRA)" <ji...@apache.org> on 2018/02/22 15:41:00 UTC

[jira] [Commented] (HIVE-18725) Improve error handling for subqueries if there is wrong column reference

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

Kryvenko Igor commented on HIVE-18725:
--------------------------------------

[~vgarg]
As i see that there are 2 subqueries in query
{code}
select col2 from table2 where table2.col1=table1.non_existing_column
{code}
and 
{code}
select 4
{code}
So this exception's message isn't misleading.
If you will delete second subquery you will got correct message
{code}
hive> create table table1(col1 int);
OK
Time taken: 2.244 seconds
hive> create table table2(col2 int, col1 int);
OK
Time taken: 0.157 seconds
hive> select * from table1 where table1.col1 IN (select col2 from table2 where table2.col1=table1.non_existing_column) and table1.col1 IN (select 4);
FAILED: SemanticException [Error 10249]: Line 1:129 Unsupported SubQuery Expression 'col1': Only 1 SubQuery expression is supported.
hive> select * from table1 where table1.col1 IN (select col2 from table2 where table2.col1=table1.non_existing_column);
FAILED: SemanticException [Error 10004]: Line 1:85 Invalid table alias or column reference 'table1': (possible column names are: col2, col1)


{code}

> Improve error handling for subqueries if there is wrong column reference
> ------------------------------------------------------------------------
>
>                 Key: HIVE-18725
>                 URL: https://issues.apache.org/jira/browse/HIVE-18725
>             Project: Hive
>          Issue Type: Improvement
>          Components: Query Planning
>            Reporter: Vineet Garg
>            Assignee: Kryvenko Igor
>            Priority: Major
>
> If there is a column reference within subquery which doesn't exist Hive throws misleading error message.
> e.g. 
> {code:sql}
> select * from table1 where table1.col1 IN (select col2 from table2 where table2.col1=table1.non_existing_column) and table1.col1 IN (select 4);
> {code}
> The above query, assuming table1 doesn't have non_existing_column, will throw following misleading error:
> {noformat}
> FAILED: SemanticException Line 0:-1 Unsupported SubQuery Expression 'col1': Only 1 SubQuery expression is supported.
> {noformat}



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