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

UNION query with regular expressions for column name does not work

    XMLWordPrintableJSON

Details

    Description

      STEPS TO REPRODUCE:

      1. Create a table:

      CREATE TABLE t (a1 INT, a2 INT);
      INSERT INTO TABLE t VALUES (1,1),(1,2),(2,1),(2,2);

      2. SET hive.support.quoted.identifiers to "none":

      SET hive.support.quoted.identifiers=none;

      3. Run the query:

      SELECT `(a1)?+.+` FROM t
      UNION
      SELECT `(a2)?+.+` FROM t;

      ACTUAL RESULT:
      The query fails with an exception:

      2019-05-23T01:36:53,604 ERROR [9aa457a9-1c74-466e-abef-ec2f007117f3 main] ql.Driver: FAILED: SemanticException Line 0:-1 Invalid column reference '`(a1)?+.+`'
      org.apache.hadoop.hive.ql.parse.SemanticException: Line 0:-1 Invalid column reference '`(a1)?+.+`'
      	at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genAllExprNodeDesc(SemanticAnalyzer.java:11734)
      	at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genExprNodeDesc(SemanticAnalyzer.java:11674)
      	at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genExprNodeDesc(SemanticAnalyzer.java:11642)
      	at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genExprNodeDesc(SemanticAnalyzer.java:11620)
      	at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genGroupByPlanMapGroupByOperator(SemanticAnalyzer.java:5225)
      	at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genGroupByPlanMapAggrNoSkew(SemanticAnalyzer.java:6330)
      	at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genBodyPlan(SemanticAnalyzer.java:9659)
      	at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:10579)
      	at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:10457)
      	at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genOPTree(SemanticAnalyzer.java:11202)
      	at org.apache.hadoop.hive.ql.parse.CalcitePlanner.genOPTree(CalcitePlanner.java:481)
      	at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.analyzeInternal(SemanticAnalyzer.java:11215)
      	at org.apache.hadoop.hive.ql.parse.CalcitePlanner.analyzeInternal(CalcitePlanner.java:286)
      	at org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:258)
      	at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:512)
      	at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1317)
      	at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1457)
      	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1237)
      	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1227)
      	at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:239)
      	at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:187)
      	at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:409)
      	at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:836)
      	at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:774)
      	at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:697)
      	at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:692)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
      	at org.apache.hadoop.util.RunJar.main(RunJar.java:136)

      FYI: sershe

      Attachments

        1. HIVE-21843.1.patch
          21 kB
          Oleksiy Sayankin
        2. HIVE-21843.10.patch
          46 kB
          Oleksiy Sayankin
        3. HIVE-21843.4.patch
          21 kB
          Oleksiy Sayankin
        4. HIVE-21843.6.patch
          46 kB
          Oleksiy Sayankin
        5. HIVE-21843.7.patch
          46 kB
          Oleksiy Sayankin
        6. HIVE-21843.8.patch
          43 kB
          Oleksiy Sayankin
        7. HIVE-21843.9.patch
          46 kB
          Oleksiy Sayankin

        Issue Links

          Activity

            People

              osayankin Oleksiy Sayankin
              osayankin Oleksiy Sayankin
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 50m
                  50m