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/04/29 15:26:51 UTC

[incubator-kyuubi] branch master updated: [KYUUBI #2478][FOLLOWUP] Invoke getOpts method instead of Reflection

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 cdfae8d87 [KYUUBI #2478][FOLLOWUP] Invoke getOpts method instead of Reflection
cdfae8d87 is described below

commit cdfae8d879194a355fdaa03dc33f23578d897402
Author: Fei Wang <fw...@ebay.com>
AuthorDate: Fri Apr 29 23:26:43 2022 +0800

    [KYUUBI #2478][FOLLOWUP] Invoke getOpts method instead of Reflection
    
    ### _Why are the changes needed?_
    
    Remove unneeded reflection.
    
    ### _How was this patch tested?_
    - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
    
    - [ ] Add screenshots for manual tests if appropriate
    
    - [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request
    
    Closes #2518 from turboFei/hive_beeline.
    
    Closes #2478
    
    f188d78b [Fei Wang] comment
    4400f365 [Fei Wang] [KYUUBI #2478][FOLLOWUP] Invoke getOpts method instead of Reflection
    
    Authored-by: Fei Wang <fw...@ebay.com>
    Signed-off-by: Fei Wang <fw...@ebay.com>
---
 .../src/main/java/org/apache/hive/beeline/KyuubiBeeLine.java  | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

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 2eec5bbfa..9ddde0055 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
@@ -162,15 +162,8 @@ public class KyuubiBeeLine extends BeeLine {
     int code = 0;
     if (cl.getOptionValues('e') != null) {
       commands = Arrays.asList(cl.getOptionValues('e'));
-      try {
-        Field optsField = BeeLine.class.getDeclaredField("opts");
-        optsField.setAccessible(true);
-        BeeLineOpts opts = (BeeLineOpts) optsField.get(this);
-        opts.setAllowMultiLineCommand(false);
-      } catch (Exception t) {
-        error(t.getMessage());
-        return 1;
-      }
+      // When using -e, command is always a single line, see HIVE-19018
+      getOpts().setAllowMultiLineCommand(false);
     }
 
     if (!commands.isEmpty() && getOpts().getScriptFile() != null) {