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 2023/03/22 11:37:46 UTC

[kyuubi] branch branch-1.7 updated: [KYUUBI #4575] Fix the empty last line may causes the session to exit directly

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

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


The following commit(s) were added to refs/heads/branch-1.7 by this push:
     new 326890c9e [KYUUBI #4575] Fix the empty last line may causes the session to exit directly
326890c9e is described below

commit 326890c9e9b361e084feb80f3d1934b18cdbff6f
Author: Alex <zo...@kanzhun.com>
AuthorDate: Wed Mar 22 19:36:43 2023 +0800

    [KYUUBI #4575] Fix the empty last line may causes the session to exit directly
    
    ### _Why are the changes needed?_
    If the last line of the file is a blank line, there may be a cmd whose content is empty but the length is not 0 after split by ";". When running to this cmd, it will return false, causing the session to exit directly.
    
    ### _How was this patch tested?_
    - [x] Add some test cases that check the changes thoroughly including negative and positive cases if possible
    vim test.sql and write :
    <img width="527" alt="image" src="https://user-images.githubusercontent.com/43542750/226647817-855d866e-836c-4c60-bc81-0bb192d3d6ff.png">
    then start beeline and source this file successfully and session won't exit:
    <img width="745" alt="image" src="https://user-images.githubusercontent.com/43542750/226652451-823891f3-2768-4165-8816-c052461d1f9c.png">
    <img width="598" alt="image" src="https://user-images.githubusercontent.com/43542750/226650769-25a8becf-4655-41ec-bf91-7ae7e28b7d34.png">
    
    - [x] Add screenshots for manual tests if appropriate
    
    - [ ] [Run test](https://kyuubi.readthedocs.io/en/master/develop_tools/testing.html#running-tests) locally before make a pull request
    
    Closes #4575 from Kiss736921/fix_file_empty_last_line.
    
    Closes #4575
    
    ff3fcb189 [Alex] fix the empty last line may causes the session to exit directly
    
    Authored-by: Alex <zo...@kanzhun.com>
    Signed-off-by: fwang12 <fw...@ebay.com>
    (cherry picked from commit 06f38846277427c9908647212b5b5b5f3dea9506)
    Signed-off-by: fwang12 <fw...@ebay.com>
---
 .../src/main/java/org/apache/hive/beeline/KyuubiCommands.java          | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kyuubi-hive-beeline/src/main/java/org/apache/hive/beeline/KyuubiCommands.java b/kyuubi-hive-beeline/src/main/java/org/apache/hive/beeline/KyuubiCommands.java
index bf368ce0d..68f16f0ba 100644
--- a/kyuubi-hive-beeline/src/main/java/org/apache/hive/beeline/KyuubiCommands.java
+++ b/kyuubi-hive-beeline/src/main/java/org/apache/hive/beeline/KyuubiCommands.java
@@ -93,8 +93,9 @@ public class KyuubiCommands extends Commands {
           lines += "\n" + extra;
         }
       }
-      String[] cmds = lines.split(";");
+      String[] cmds = lines.split(beeLine.getOpts().getDelimiter());
       for (String c : cmds) {
+        c = c.trim();
         if (!executeInternal(c, false)) {
           return false;
         }