You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by Chaoyu Tang <ct...@gmail.com> on 2015/10/25 01:12:18 UTC
Review Request 39626: HIVE-12259: Command containing semicolon is
broken in Beeline
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/39626/
-----------------------------------------------------------
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
Re: Review Request 39626: HIVE-12259: Command containing semicolon is
broken in Beeline
Posted by cheng xu <ch...@intel.com>.
> 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
>
>
Re: Review Request 39626: HIVE-12259: Command containing semicolon is
broken in Beeline
Posted by Chaoyu Tang <ct...@gmail.com>.
> On Oct. 26, 2015, 1: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);
> > }
> > ```
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.
- Chaoyu
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/39626/#review103971
-----------------------------------------------------------
On Oct. 24, 2015, 11:13 p.m., Chaoyu Tang wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/39626/
> -----------------------------------------------------------
>
> (Updated Oct. 24, 2015, 11:13 p.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
>
>
Re: Review Request 39626: HIVE-12259: Command containing semicolon is
broken in Beeline
Posted by cheng xu <ch...@intel.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/39626/#review103971
-----------------------------------------------------------
Thank you for working on this. I have a comment left.
beeline/src/java/org/apache/hive/beeline/BeeLine.java (line 1111)
<https://reviews.apache.org/r/39626/#comment162086>
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);
}
```
- cheng xu
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
>
>
Re: Review Request 39626: HIVE-12259: Command containing semicolon is
broken in Beeline
Posted by cheng xu <ch...@intel.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/39626/#review103978
-----------------------------------------------------------
Ship it!
Ship It!
- cheng xu
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
>
>
Re: Review Request 39626: HIVE-12259: Command containing semicolon is
broken in Beeline
Posted by Chaoyu Tang <ct...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/39626/
-----------------------------------------------------------
(Updated Oct. 24, 2015, 11:13 p.m.)
Review request for hive.
Changes
-------
Remove the trailing space
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 (updated)
-----
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