You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Vineet Garg (JIRA)" <ji...@apache.org> on 2018/05/23 05:00:00 UTC

[jira] [Assigned] (HIVE-19670) Correlated subquery in select produces result instead of throwing an error

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

Vineet Garg reassigned HIVE-19670:
----------------------------------


> Correlated subquery in select produces result instead of throwing an error 
> ---------------------------------------------------------------------------
>
>                 Key: HIVE-19670
>                 URL: https://issues.apache.org/jira/browse/HIVE-19670
>             Project: Hive
>          Issue Type: Bug
>          Components: Logical Optimizer
>    Affects Versions: 2.3.0
>            Reporter: Vineet Garg
>            Assignee: Vineet Garg
>            Priority: Major
>
> {code:sql}
> create table friends (
>   id int not null,
>   friend_id int,
>   primary key (id),
>   foreign key (friend_id) references friends (id)
> );
> insert into friends values
> (210, null),
> (209, 210),
> (202, 209),
> (208, 202),
> (207, 209),
> (203, 207),
> (201, null),
> (204, null),
> (205, null),
> (206, 209);
> SELECT id,
>  (SELECT id
>   FROM friends as f2
>   WHERE f2.friend_id = f1.friend_id) AS friend
> FROM friends as f1
> WHERE id = '202'
> {code}
> Select query should throw an error since subquery will result in more than one row. But hive produces following result:
> {noformat}
> 202	202
> 202	207
> 202	206
> {noformat}



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