Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-19670

Correlated subquery in select produces result instead of throwing an error

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.3.0
    • None
    • Logical Optimizer
    • None

    Description

      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'
      

      Select query should throw an error since subquery will result in more than one row. But hive produces following result:

      202	202
      202	207
      202	206
      

      Attachments

        Activity

          People

            vgarg Vineet Garg
            vgarg Vineet Garg
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: