From fd9c92536b287fff3bde7ffb5aafa867f1c3fcaa Mon Sep 17 00:00:00 2001 From: senmiaoliu Date: Wed, 28 Feb 2024 15:50:27 +0800 Subject: [PATCH] respect beeline verbose --- .../main/java/org/apache/hive/beeline/KyuubiBeeLine.java | 4 ++++ .../java/org/apache/hive/beeline/KyuubiBeeLineTest.java | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/kyuubi-hive-beeline/src/main/java/org/apache/hive/beeline/KyuubiBeeLine.java b/kyuubi-hive-beeline/src/main/java/org/apache/hive/beeline/KyuubiBeeLine.java index 8ef5454fa7d..706fce467aa 100644 --- a/kyuubi-hive-beeline/src/main/java/org/apache/hive/beeline/KyuubiBeeLine.java +++ b/kyuubi-hive-beeline/src/main/java/org/apache/hive/beeline/KyuubiBeeLine.java @@ -191,6 +191,10 @@ protected void processOption(String arg, ListIterator iter) throws ParseExceptio }; cl = beelineParser.parse(options, args); + if (getOpts().getVerbose()) { + ignoreLaunchEngine = false; + } + connSuccessful = DynMethods.builder("connectUsingArgs") .hiddenImpl(BeeLine.class, BeelineParser.class, CommandLine.class) diff --git a/kyuubi-hive-beeline/src/test/java/org/apache/hive/beeline/KyuubiBeeLineTest.java b/kyuubi-hive-beeline/src/test/java/org/apache/hive/beeline/KyuubiBeeLineTest.java index 278a53872a7..9cdc3340c32 100644 --- a/kyuubi-hive-beeline/src/test/java/org/apache/hive/beeline/KyuubiBeeLineTest.java +++ b/kyuubi-hive-beeline/src/test/java/org/apache/hive/beeline/KyuubiBeeLineTest.java @@ -19,6 +19,7 @@ package org.apache.hive.beeline; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.io.IOException; @@ -104,7 +105,13 @@ public void testKyuubiBeelineIgnoreLaunchEngine() { String[] args3 = {"-u", "badUrl"}; kyuubiBeeLine.initArgs(args3); - assertTrue(!kyuubiBeeLine.isIgnoreLaunchEngine()); + assertFalse(kyuubiBeeLine.isIgnoreLaunchEngine()); + kyuubiBeeLine.setIgnoreLaunchEngine(false); + + String[] args4 = {"--ignore-launch-engine", "--verbose", "-f", "test.sql"}; + kyuubiBeeLine.initArgs(args4); + assertFalse(kyuubiBeeLine.isIgnoreLaunchEngine()); + assert kyuubiBeeLine.getOpts().getScriptFile().equals("test.sql"); kyuubiBeeLine.setIgnoreLaunchEngine(false); }