You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by fe...@apache.org on 2022/07/09 11:43:12 UTC

[incubator-kyuubi] branch master updated: [KYUUBI #2478][FOLLOWUP] Fix bin/beeline without -u exits unexpectedly

This is an automated email from the ASF dual-hosted git repository.

feiwang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-kyuubi.git


The following commit(s) were added to refs/heads/master by this push:
     new e49299499 [KYUUBI #2478][FOLLOWUP] Fix bin/beeline without -u exits unexpectedly
e49299499 is described below

commit e4929949962a861bb249036dd6ca4bd085f3ed25
Author: jiaoqingbo <11...@qq.com>
AuthorDate: Sat Jul 9 19:43:04 2022 +0800

    [KYUUBI #2478][FOLLOWUP] Fix bin/beeline without -u exits unexpectedly
    
    ### _Why are the changes needed?_
    
    fix #3030
    
    ### _How was this patch tested?_
    - [x] Add some test cases that check the changes thoroughly including negative and positive cases if possible
    
    - [x] Add screenshots for manual tests if appropriate
    ![image](https://user-images.githubusercontent.com/14961757/177953720-029882e5-2454-4091-aa75-d008e15ee1a0.png)
    
    - [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request
    
    Closes #3031 from jiaoqingbo/kyuubi-3030.
    
    Closes #2478
    
    58ba0118 [jiaoqingbo] change junit location
    a4130dad [jiaoqingbo] add license
    9ff13665 [jiaoqingbo] [KYUUBI #3030] fix bin/beeline without -u exits unexpectedly
    
    Authored-by: jiaoqingbo <11...@qq.com>
    Signed-off-by: Fei Wang <fw...@ebay.com>
---
 kyuubi-hive-beeline/pom.xml                        |  6 ++++
 .../org/apache/hive/beeline/KyuubiBeeLine.java     |  4 +--
 .../org/apache/hive/beeline/KyuubiBeeLineTest.java | 32 ++++++++++++++++++++++
 3 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/kyuubi-hive-beeline/pom.xml b/kyuubi-hive-beeline/pom.xml
index 0b62dc55f..406512ade 100644
--- a/kyuubi-hive-beeline/pom.xml
+++ b/kyuubi-hive-beeline/pom.xml
@@ -166,6 +166,12 @@
                 </exclusion>
             </exclusions>
         </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>
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 9ddde0055..7711e21b6 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
@@ -149,9 +149,9 @@ public class KyuubiBeeLine extends BeeLine {
     if (!connSuccessful && !exit) {
       try {
         Method defaultBeelineConnectMethod =
-            BeeLine.class.getDeclaredMethod("defaultBeelineConnect");
+            BeeLine.class.getDeclaredMethod("defaultBeelineConnect", CommandLine.class);
         defaultBeelineConnectMethod.setAccessible(true);
-        connSuccessful = (boolean) defaultBeelineConnectMethod.invoke(this);
+        connSuccessful = (boolean) defaultBeelineConnectMethod.invoke(this, cl);
 
       } catch (Exception t) {
         error(t.getMessage());
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
new file mode 100644
index 000000000..b144c95c6
--- /dev/null
+++ b/kyuubi-hive-beeline/src/test/java/org/apache/hive/beeline/KyuubiBeeLineTest.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hive.beeline;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class KyuubiBeeLineTest {
+  @Test
+  public void testKyuubiBeelineWithoutArgs() {
+    KyuubiBeeLine kyuubiBeeLine = new KyuubiBeeLine();
+    int result = kyuubiBeeLine.initArgs(new String[0]);
+    assertEquals(0, result);
+  }
+}