abstractdog commented on code in PR #6959:
URL: https://github.com/apache/hive/pull/6959#discussion_r4625316419


##########
beeline/src/test/org/apache/hive/beeline/TestCommands.java:
##########
@@ -376,5 +383,51 @@ public void testGetCmdList() throws Exception {
       beeline.close();
     }
   }
+
+  @Test
+  public void testSourceFileDelimiterInQuery() throws Exception {
+    List<String> statements = Arrays.asList(
+        "select 'foo;bar' as s",
+        "select current_database() as db",
+        "select 1 as ok",
+        "select 2 as also_ok",
+        "select 1 as a",
+        "select /* part; two */ 2 as b");
+    assertEquals(statements, sourceScript(toScript(statements)));
+
+    assertEquals(Collections.emptyList(), sourceScript(""));
+    assertEquals(Collections.emptyList(),
+        sourceScript("-- only a comment; with semicolon\n# shell; comment\n"));
+
+    assertEquals(Arrays.asList("select 1"),
+        sourceScript("select 1; -- note; more\nselect 2;\n"));

Review Comment:
   A `--` comment runs to the end of the line, so I believe the newline decides 
which text is comment and which is code. For
   
   ```sql
   select 1; -- note; more
   select 2;
   ```
   
   I'd expect `select 1` and `select 2` to both run, as they do with `beeline 
-f`,



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to