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

Invalid position alias in Group By when CBO failed

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.2.1, 2.1.1
    • 2.2.0
    • CBO
    • None

    Description

      for example´╝Ü
      create table alias_test_01(a INT, b STRING) ;
      create table alias_test_02(a INT, b STRING) ;
      create table alias_test_03(a INT, b STRING) ;

      set hive.groupby.position.alias = true;
      set hive.cbo.enable=true;

      explain
      select * from
      alias_test_01 alias01
      left join
      (
      select 2017 as a, b from alias_test_02 group by 1, 2
      ) alias02
      on alias01.a = alias02.a
      left join
      alias_test_03 alias03
      on alias01.a = alias03.a;

      error info:
      FAILED: SemanticException [Error 10220]: Invalid position alias in Group By
      Position alias: 2017 does not exist
      The Select List is indexed from 1 to 2

      the first process Position Alias result:
      when CBO optimize failed and reAnalyzeAST is true, position alias will be processed twice.
      1. 'group by 1, 2' convert to 'group by 2017, b'
      2. 'group by 2017, b' 2017 column does not exist

      Attachments

        1. HIVE-15874.patch
          11 kB
          Walter Wu

        Activity

          People

            pxiong Pengcheng Xiong
            Walter Wu Walter Wu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: