Vineet Garg created HIVE-19670: ---------------------------------- Summary: 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
{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)