You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by "turboFei (via GitHub)" <gi...@apache.org> on 2023/06/15 23:35:05 UTC

[GitHub] [kyuubi] turboFei commented on a diff in pull request #4965: [BEELINE] Support `--python-mode` option and remove comments for non-python mode

turboFei commented on code in PR #4965:
URL: https://github.com/apache/kyuubi/pull/4965#discussion_r1231626443


##########
kyuubi-hive-beeline/src/test/java/org/apache/hive/beeline/KyuubiBeeLineTest.java:
##########
@@ -47,4 +52,73 @@ public void testKyuubiBeelineExitCodeWithoutConnection() {
     int result3 = kyuubiBeeLine.initArgs(args3);
     assertEquals(1, result3);
   }
+
+  @Test
+  public void testKyuubiBeeLineCmdUsage() {
+    BufferPrintStream printStream = new BufferPrintStream();
+
+    KyuubiBeeLine kyuubiBeeLine = new KyuubiBeeLine();
+    DynFields.builder()
+        .hiddenImpl(BeeLine.class, "outputStream")
+        .build(kyuubiBeeLine)
+        .set(printStream);
+    String[] args1 = {"-h"};
+    kyuubiBeeLine.initArgs(args1);
+    String output = printStream.getOutput();
+    assert output.contains("--python-mode                   Execute python code/script.");
+  }
+
+  @Test
+  public void testKyuubiBeeLinePythonMode() {
+    KyuubiBeeLine kyuubiBeeLine = new KyuubiBeeLine();
+    String[] args1 = {"-u", "badUrl", "--python-mode"};
+    kyuubiBeeLine.initArgs(args1);
+    assertTrue(kyuubiBeeLine.isPythonMode());
+    kyuubiBeeLine.setPythonMode(false);
+
+    String[] args2 = {"--python-mode", "-f", "test.sql"};
+    kyuubiBeeLine.initArgs(args2);
+    assertTrue(kyuubiBeeLine.isPythonMode());
+    assert kyuubiBeeLine.getOpts().getScriptFile().equals("test.sql");
+    kyuubiBeeLine.setPythonMode(false);
+
+    String[] args3 = {"-u", "badUrl"};
+    kyuubiBeeLine.initArgs(args3);
+    assertTrue(!kyuubiBeeLine.isPythonMode());
+    kyuubiBeeLine.setPythonMode(false);
+  }
+
+  static class BufferPrintStream extends PrintStream {
+    public StringBuilder stringBuilder = new StringBuilder();
+
+    static OutputStream noOpOutputStream =

Review Comment:
   it is used.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org