> On Oct. 26, 2015, 9:14 a.m., cheng xu wrote: > > beeline/src/java/org/apache/hive/beeline/BeeLine.java, line 1111 > > <https://reviews.apache.org/r/39626/diff/2/?file=1106510#file1106510line1111> > > > > Method `exeCommandWithPrefix` failed to handle the commands like `!sh > > test.sql;show\n tables;`. For connect command, it's possible to contain > > semicolon in the connection string. So I am thinking about whether we can > > escape connect command. How about the following code? > > ``` > > if > > (!line.startsWith(COMMAND_PREFIX)&&line.contains(";")&&!line.startWith("!connect")) > > { > > return commands.sql(line, getOpts().getEntireLineAsCommand()); > > } else { > > // handle SQLLine command in beeline which starts with ! and > > does not end with ; > > return execCommandWithPrefix(line); > > } > > ``` > > Chaoyu Tang wrote: > A subset of BeeLine commands are actually SQLLine commands (see > https://cwiki.apache.org/confluence/display/Hive/HiveServer2+Clients). They > include !connect which could be found in http://sqlline.sourceforge.net/. > These commands are quite special since they start with ! and do NOT have to > terminate with ; > So for the approach you suggested, for the rest SQLLine commands, I think > they will be prompted for more inputs till the line terminator ; is > encountered (multi-lines command) > As for the case you provided, both !sh and show are not SQLLine commands. > > So I wonder if it will make more sense and be clearer if we document that > the SQLLine commands could not be used for multi-commands-in-one-line or > mulit-lines command. Otherwise, combined with multi-lines command support, we > will run into many backward issues.
LGTM. +1 - cheng ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/39626/#review103971 ----------------------------------------------------------- On Oct. 25, 2015, 7:13 a.m., Chaoyu Tang wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/39626/ > ----------------------------------------------------------- > > (Updated Oct. 25, 2015, 7:13 a.m.) > > > Review request for hive. > > > Bugs: HIVE-12259 > https://issues.apache.org/jira/browse/HIVE-12259 > > > Repository: hive-git > > > Description > ------- > > The SQLLine commands (!cmd) and Connection URLs are broken if they contain > the ";" > > > Diffs > ----- > > beeline/src/java/org/apache/hive/beeline/BeeLine.java 69e9418 > > itests/hive-unit/src/test/java/org/apache/hive/beeline/TestBeeLineWithArgs.java > 0465ef3 > > Diff: https://reviews.apache.org/r/39626/diff/ > > > Testing > ------- > > New unit tests passed > Submitted precommit tests > > > Thanks, > > Chaoyu Tang > >