ujc714 opened a new pull request #1814: URL: https://github.com/apache/hive/pull/1814
### What changes were proposed in this pull request? 1) Don't check if a line is a comment in Beeline.dispatch(). Instead, remove the comments from the line. 2) Replace removeComments(String, int[]) with removeComments(String) in Commands.handleMultiLineCmd(). ### Why are the changes needed? 1) The queries in '-e' parameter is passed to Beeline.dispatch() as a single line although there could be multiple lines. If the first line is a comment, the rest lines are ignored. We should pass the query strings to Commands.execute(). 2) HiveStringUtils.removeComments(String, int[]) is used for a single line. In this method. If we use it to check a multiple line string and there is one comment line, the lines after this comment line will be discarded. In fact, HiveStringUtils.removeComments(String) splits a multiple line string to several single line strings and calls HiveStringUtils.removeComments(String, int[]) to process each single line. So HiveStringUtils.removeComments(String) is what we should use in Commands.handleMultiLineCmd(). ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? 1) org.apache.hive.beeline.testLinesEndingWithComments is used to test HiveStringUtils.removeComments(String). 2) org.apache.hive.beeline.cli.testSqlFromCmdWithComments* are used to test queries passed via '-e' option. And testSqlFromCmdWithComments2 is used to test the query after a comment line. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
