This is an automated email from the ASF dual-hosted git repository. kgyrtkirk pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/hive.git
The following commit(s) were added to refs/heads/master by this push: new 651b0ef HIVE-25095: Beeline/hive -e command can't deal with query with trailing quote (#2526) (Robbie Zhang reviewed by Zoltan Haindrich) 651b0ef is described below commit 651b0ef7f1e4c6b0e4696ccd75e032ab965006bc Author: Robbie Zhang <yibinzh...@mail.com> AuthorDate: Thu Nov 18 18:22:07 2021 +1100 HIVE-25095: Beeline/hive -e command can't deal with query with trailing quote (#2526) (Robbie Zhang reviewed by Zoltan Haindrich) Co-authored-by: Robbie Zhang <rzh...@cloudera.com> --- beeline/src/test/org/apache/hive/beeline/TestBeelineArgParsing.java | 4 +++- beeline/src/test/org/apache/hive/beeline/cli/TestHiveCli.java | 6 ++++++ pom.xml | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/beeline/src/test/org/apache/hive/beeline/TestBeelineArgParsing.java b/beeline/src/test/org/apache/hive/beeline/TestBeelineArgParsing.java index 26e118a..26a892f 100644 --- a/beeline/src/test/org/apache/hive/beeline/TestBeelineArgParsing.java +++ b/beeline/src/test/org/apache/hive/beeline/TestBeelineArgParsing.java @@ -193,11 +193,13 @@ public class TestBeelineArgParsing { public void testQueryScripts() throws Exception { TestBeeline bl = new TestBeeline(); String args[] = new String[] {"-u", "url", "-n", "name", - "-p", "password", "-d", "driver", "-e", "select1", "-e", "select2"}; + "-p", "password", "-d", "driver", "-e", "select1", "-e", "select2", + "-e", "select \"hive\""}; Assert.assertEquals(0, bl.initArgs(args)); Assert.assertTrue(bl.connectArgs.equals("url name password driver")); Assert.assertTrue(bl.queries.contains("select1")); Assert.assertTrue(bl.queries.contains("select2")); + Assert.assertTrue(bl.queries.contains("select \"hive\"")); } /** diff --git a/beeline/src/test/org/apache/hive/beeline/cli/TestHiveCli.java b/beeline/src/test/org/apache/hive/beeline/cli/TestHiveCli.java index 1e68405..5ea4d11 100644 --- a/beeline/src/test/org/apache/hive/beeline/cli/TestHiveCli.java +++ b/beeline/src/test/org/apache/hive/beeline/cli/TestHiveCli.java @@ -168,6 +168,12 @@ public class TestHiveCli { } @Test + public void testSqlFromCmdWithEmbeddedQuotes() { + verifyCMD(null, "hive", out, + new String[] { "-e", "select \"hive\"" }, ERRNO_OK, true); + } + + @Test public void testInvalidOptions() { verifyCMD(null, "The '-e' and '-f' options cannot be specified simultaneously", err, diff --git a/pom.xml b/pom.xml index c5542e4..3f28653 100644 --- a/pom.xml +++ b/pom.xml @@ -118,7 +118,7 @@ <datanucleus-core.version>5.2.4</datanucleus-core.version> <datanucleus-jdo.version>3.2.0-release</datanucleus-jdo.version> <datanucleus-rdbms.version>5.2.4</datanucleus-rdbms.version> - <commons-cli.version>1.2</commons-cli.version> + <commons-cli.version>1.4</commons-cli.version> <commons-codec.version>1.15</commons-codec.version> <commons-collections.version>3.2.2</commons-collections.version> <commons-collections4.version>4.1</commons-collections4.version>