[ https://issues.apache.org/jira/browse/HIVE-21843?focusedWorklogId=517945&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-517945 ]
ASF GitHub Bot logged work on HIVE-21843: ----------------------------------------- Author: ASF GitHub Bot Created on: 30/Nov/20 13:57 Start Date: 30/Nov/20 13:57 Worklog Time Spent: 10m Work Description: kasakrisz commented on a change in pull request #1684: URL: https://github.com/apache/hive/pull/1684#discussion_r532610692 ########## File path: ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java ########## @@ -4453,7 +4452,7 @@ private boolean isAggregateInSelect(Node node, Collection<ASTNode> aggregateFunc * Returns whether the pattern is a regex expression (instead of a normal * string). Normal string is a string with all alphabets/digits and "_". */ - boolean isRegex(String pattern, HiveConf conf) { + static boolean isRegex(String pattern, HiveConf conf) { Review comment: This function is called from `SemanticAnalyzer` and its subclasses. I haven't found any other invocations. Is it necessary to change this to `static` ? ########## File path: ql/src/test/org/apache/hadoop/hive/ql/parse/authorization/PrivilegesTestBase.java ########## @@ -35,8 +37,9 @@ public static void grantUserTable(String privStr, PrivilegeType privType, QueryState queryState, Hive db) throws Exception { + Context ctx=new Context(new HiveConf()); DDLWork work = AuthorizationTestUtil.analyze( - "GRANT " + privStr + " ON TABLE " + TABLE + " TO USER " + USER, queryState, db); + "GRANT " + privStr + " ON TABLE " + TABLE + " TO USER " + USER, queryState, db,ctx); Review comment: nit: space `queryState, db, ctx);` ########## File path: ql/src/test/org/apache/hadoop/hive/ql/tool/TestLineageInfo.java ########## @@ -58,7 +76,7 @@ public void testSimpleQuery() { try { lep.getLineageInfo("INSERT OVERWRITE TABLE dest1 partition (ds = '111') " + "SELECT s.* FROM srcpart TABLESAMPLE (BUCKET 1 OUT OF 1) s " - + "WHERE s.ds='2008-04-08' and s.hr='11'"); + + "WHERE s.ds='2008-04-08' and s.hr='11'",ctx); Review comment: nit: space `s.hr='11'", ctx);` ########## File path: ql/src/test/org/apache/hadoop/hive/ql/tool/TestLineageInfo.java ########## @@ -128,7 +136,7 @@ public void testSimpleQuery5() { LineageInfo lep = new LineageInfo(); try { lep.getLineageInfo("insert overwrite table x select a.y, b.y " - + "from a a full outer join b b on (a.x = b.y)"); + + "from a a full outer join b b on (a.x = b.y)",ctx); Review comment: `(a.x = b.y)", ctx);` ########## File path: ql/src/test/org/apache/hadoop/hive/ql/tool/TestLineageInfo.java ########## @@ -71,47 +89,37 @@ public void testSimpleQuery() { } @Test - public void testSimpleQuery2() { + public void testSimpleQuery2() throws Exception { LineageInfo lep = new LineageInfo(); - try { - lep.getLineageInfo("FROM (FROM src select src.key, src.value " - + "WHERE src.key < 10 UNION ALL FROM src SELECT src.* WHERE src.key > 10 ) unioninput " - + "INSERT OVERWRITE DIRECTORY '../../../../build/contrib/hive/ql/test/data/warehouse/union.out' " - + "SELECT unioninput.*"); - TreeSet<String> i = new TreeSet<String>(); - TreeSet<String> o = new TreeSet<String>(); - i.add("src"); - checkOutput(lep, i, o); - } catch (Exception e) { - e.printStackTrace(); - fail("Failed"); - } + lep.getLineageInfo("FROM (FROM src select src.key, src.value " + + "WHERE src.key < 10 UNION ALL FROM src SELECT src.* WHERE src.key > 10 ) unioninput " + + "INSERT OVERWRITE DIRECTORY '../../../../build/contrib/hive/ql/test/data/warehouse/union.out' " + + "SELECT unioninput.*",ctx); + TreeSet<String> i = new TreeSet<String>(); + TreeSet<String> o = new TreeSet<String>(); + i.add("src"); + checkOutput(lep, i, o); } @Test - public void testSimpleQuery3() { + public void testSimpleQuery3() throws Exception { LineageInfo lep = new LineageInfo(); - try { - lep.getLineageInfo("FROM (FROM src select src.key, src.value " - + "WHERE src.key < 10 UNION ALL FROM src1 SELECT src1.* WHERE src1.key > 10 ) unioninput " - + "INSERT OVERWRITE DIRECTORY '../../../../build/contrib/hive/ql/test/data/warehouse/union.out' " - + "SELECT unioninput.*"); - TreeSet<String> i = new TreeSet<String>(); - TreeSet<String> o = new TreeSet<String>(); - i.add("src"); - i.add("src1"); - checkOutput(lep, i, o); - } catch (Exception e) { - e.printStackTrace(); - fail("Failed"); - } + lep.getLineageInfo("FROM (FROM src select src.key, src.value " + + "WHERE src.key < 10 UNION ALL FROM src1 SELECT src1.* WHERE src1.key > 10 ) unioninput " + + "INSERT OVERWRITE DIRECTORY '../../../../build/contrib/hive/ql/test/data/warehouse/union.out' " + + "SELECT unioninput.*",ctx); + TreeSet<String> i = new TreeSet<String>(); + TreeSet<String> o = new TreeSet<String>(); + i.add("src"); + i.add("src1"); + checkOutput(lep, i, o); } @Test public void testSimpleQuery4() { LineageInfo lep = new LineageInfo(); try { - lep.getLineageInfo("FROM ( FROM ( FROM src1 src1 SELECT src1.key AS c1, src1.value AS c2 WHERE src1.key > 10 and src1.key < 20) a RIGHT OUTER JOIN ( FROM src2 src2 SELECT src2.key AS c3, src2.value AS c4 WHERE src2.key > 15 and src2.key < 25) b ON (a.c1 = b.c3) SELECT a.c1 AS c1, a.c2 AS c2, b.c3 AS c3, b.c4 AS c4) c SELECT c.c1, c.c2, c.c3, c.c4"); + lep.getLineageInfo("FROM ( FROM ( FROM src1 src1 SELECT src1.key AS c1, src1.value AS c2 WHERE src1.key > 10 and src1.key < 20) a RIGHT OUTER JOIN ( FROM src2 src2 SELECT src2.key AS c3, src2.value AS c4 WHERE src2.key > 15 and src2.key < 25) b ON (a.c1 = b.c3) SELECT a.c1 AS c1, a.c2 AS c2, b.c3 AS c3, b.c4 AS c4) c SELECT c.c1, c.c2, c.c3, c.c4",ctx); Review comment: `c.c4", ctx);` ########## File path: ql/src/test/org/apache/hadoop/hive/ql/parse/authorization/TestHiveAuthorizationTaskFactory.java ########## @@ -457,7 +458,7 @@ public void testGrantServer() throws Exception { } private DDLWork analyze(String command) throws Exception { - return AuthorizationTestUtil.analyze(command, queryState, db); + return AuthorizationTestUtil.analyze(command, queryState, db,new Context(queryState.getConf())); Review comment: nit: space `db, new Context` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 517945) Time Spent: 20m (was: 10m) > UNION query with regular expressions for column name does not work > ------------------------------------------------------------------ > > Key: HIVE-21843 > URL: https://issues.apache.org/jira/browse/HIVE-21843 > Project: Hive > Issue Type: Bug > Components: Parser > Reporter: Oleksiy Sayankin > Assignee: Oleksiy Sayankin > Priority: Critical > Labels: pull-request-available > Attachments: HIVE-21843.1.patch, HIVE-21843.10.patch, > HIVE-21843.4.patch, HIVE-21843.6.patch, HIVE-21843.7.patch, > HIVE-21843.8.patch, HIVE-21843.9.patch > > Time Spent: 20m > Remaining Estimate: 0h > > *STEPS TO REPRODUCE:* > 1. Create a table: > {code:java}CREATE TABLE t (a1 INT, a2 INT); > INSERT INTO TABLE t VALUES (1,1),(1,2),(2,1),(2,2);{code} > 2. SET hive.support.quoted.identifiers to "none": > {code:java}SET hive.support.quoted.identifiers=none;{code} > 3. Run the query: > {code:java}SELECT `(a1)?+.+` FROM t > UNION > SELECT `(a2)?+.+` FROM t;{code} > *ACTUAL RESULT:* > The query fails with an exception: > {code:java}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){code} > FYI: [~sershe] -- This message was sent by Atlassian Jira (v8.3.4#803005)