You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by Szehon Ho <sz...@cloudera.com> on 2014/03/17 22:39:06 UTC

Review Request 19322: HIVE-6685 Beeline throws ArrayIndexOutOfBoundsException for mismatched arguments

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/19322/
-----------------------------------------------------------

Review request for hive and Xuefu Zhang.


Repository: hive-git


Description
-------

Improving the error-handling in ArrayIndexOutOfBoundsException of Beeline.


Diffs
-----

  beeline/src/java/org/apache/hive/beeline/BeeLine.java 3482186 

Diff: https://reviews.apache.org/r/19322/diff/


Testing
-------

Manual test.  Now, in this scenario it will display the usage like:

Returns a proper usage message in this scenario, like:

beeline -u
Usage: java org.apache.hive.cli.beeline.BeeLine 
   -u <database url>               the JDBC URL to connect to
   -n <username>                   the username to connect as
   -p <password>                   the password to connect as
...


Thanks,

Szehon Ho


Re: Review Request 19322: HIVE-6685 Beeline throws ArrayIndexOutOfBoundsException for mismatched arguments

Posted by Szehon Ho <sz...@cloudera.com>.

> On March 17, 2014, 9:44 p.m., Xuefu Zhang wrote:
> > beeline/src/java/org/apache/hive/beeline/BeeLine.java, line 573
> > <https://reviews.apache.org/r/19322/diff/1/?file=524852#file524852line573>
> >
> >     I think we should prevent the exception from happening rather than capturing it after it happens, if this is possible. Also, I'm not sure if this will give enough error message to the user.

Thanks Xuefu for looking at this.  Yea thats a good point, but coulnd't think of a way to do it cleanly without going into each if statement that references args[i++..] and adding a case there.  Is there any way you were thinking?


- Szehon


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/19322/#review37478
-----------------------------------------------------------


On March 17, 2014, 9:41 p.m., Szehon Ho wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/19322/
> -----------------------------------------------------------
> 
> (Updated March 17, 2014, 9:41 p.m.)
> 
> 
> Review request for hive and Xuefu Zhang.
> 
> 
> Bugs: HIVE-6685
>     https://issues.apache.org/jira/browse/HIVE-6685
> 
> 
> Repository: hive-git
> 
> 
> Description
> -------
> 
> Improving the error-handling in ArrayIndexOutOfBoundsException of Beeline.
> 
> 
> Diffs
> -----
> 
>   beeline/src/java/org/apache/hive/beeline/BeeLine.java 3482186 
> 
> Diff: https://reviews.apache.org/r/19322/diff/
> 
> 
> Testing
> -------
> 
> Manual test.  Now, in this scenario it will display the usage like:
> 
> beeline -u
> Usage: java org.apache.hive.cli.beeline.BeeLine 
>    -u <database url>               the JDBC URL to connect to
>    -n <username>                   the username to connect as
>    -p <password>                   the password to connect as
> ...
> 
> 
> Thanks,
> 
> Szehon Ho
> 
>


Re: Review Request 19322: HIVE-6685 Beeline throws ArrayIndexOutOfBoundsException for mismatched arguments

Posted by Xuefu Zhang <xz...@cloudera.com>.

> On March 17, 2014, 9:44 p.m., Xuefu Zhang wrote:
> > beeline/src/java/org/apache/hive/beeline/BeeLine.java, line 573
> > <https://reviews.apache.org/r/19322/diff/1/?file=524852#file524852line573>
> >
> >     I think we should prevent the exception from happening rather than capturing it after it happens, if this is possible. Also, I'm not sure if this will give enough error message to the user.
> 
> Szehon Ho wrote:
>     Thanks Xuefu for looking at this.  Yea thats a good point, but coulnd't think of a way to do it cleanly without going into each if statement that references args[i++..] and adding a case there.  Is there any way you were thinking?

There are standard commandline option processors. You may also refer to Hive CLI, which doesn't seem suffering from the same problem.


- Xuefu


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/19322/#review37478
-----------------------------------------------------------


On March 17, 2014, 9:41 p.m., Szehon Ho wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/19322/
> -----------------------------------------------------------
> 
> (Updated March 17, 2014, 9:41 p.m.)
> 
> 
> Review request for hive and Xuefu Zhang.
> 
> 
> Bugs: HIVE-6685
>     https://issues.apache.org/jira/browse/HIVE-6685
> 
> 
> Repository: hive-git
> 
> 
> Description
> -------
> 
> Improving the error-handling in ArrayIndexOutOfBoundsException of Beeline.
> 
> 
> Diffs
> -----
> 
>   beeline/src/java/org/apache/hive/beeline/BeeLine.java 3482186 
> 
> Diff: https://reviews.apache.org/r/19322/diff/
> 
> 
> Testing
> -------
> 
> Manual test.  Now, in this scenario it will display the usage like:
> 
> beeline -u
> Usage: java org.apache.hive.cli.beeline.BeeLine 
>    -u <database url>               the JDBC URL to connect to
>    -n <username>                   the username to connect as
>    -p <password>                   the password to connect as
> ...
> 
> 
> Thanks,
> 
> Szehon Ho
> 
>


Re: Review Request 19322: HIVE-6685 Beeline throws ArrayIndexOutOfBoundsException for mismatched arguments

Posted by Xuefu Zhang <xz...@cloudera.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/19322/#review37478
-----------------------------------------------------------



beeline/src/java/org/apache/hive/beeline/BeeLine.java
<https://reviews.apache.org/r/19322/#comment69011>

    I think we should prevent the exception from happening rather than capturing it after it happens, if this is possible. Also, I'm not sure if this will give enough error message to the user.


- Xuefu Zhang


On March 17, 2014, 9:41 p.m., Szehon Ho wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/19322/
> -----------------------------------------------------------
> 
> (Updated March 17, 2014, 9:41 p.m.)
> 
> 
> Review request for hive and Xuefu Zhang.
> 
> 
> Bugs: HIVE-6685
>     https://issues.apache.org/jira/browse/HIVE-6685
> 
> 
> Repository: hive-git
> 
> 
> Description
> -------
> 
> Improving the error-handling in ArrayIndexOutOfBoundsException of Beeline.
> 
> 
> Diffs
> -----
> 
>   beeline/src/java/org/apache/hive/beeline/BeeLine.java 3482186 
> 
> Diff: https://reviews.apache.org/r/19322/diff/
> 
> 
> Testing
> -------
> 
> Manual test.  Now, in this scenario it will display the usage like:
> 
> beeline -u
> Usage: java org.apache.hive.cli.beeline.BeeLine 
>    -u <database url>               the JDBC URL to connect to
>    -n <username>                   the username to connect as
>    -p <password>                   the password to connect as
> ...
> 
> 
> Thanks,
> 
> Szehon Ho
> 
>


Re: Review Request 19322: HIVE-6685 Beeline throws ArrayIndexOutOfBoundsException for mismatched arguments

Posted by Szehon Ho <sz...@cloudera.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/19322/#review37497
-----------------------------------------------------------



beeline/src/java/org/apache/hive/beeline/BeeLine.java
<https://reviews.apache.org/r/19322/#comment69036>

    Yea thats a valid suggestion, I'll take a look and get back.  Thanks.


- Szehon Ho


On March 17, 2014, 9:41 p.m., Szehon Ho wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/19322/
> -----------------------------------------------------------
> 
> (Updated March 17, 2014, 9:41 p.m.)
> 
> 
> Review request for hive and Xuefu Zhang.
> 
> 
> Bugs: HIVE-6685
>     https://issues.apache.org/jira/browse/HIVE-6685
> 
> 
> Repository: hive-git
> 
> 
> Description
> -------
> 
> Improving the error-handling in ArrayIndexOutOfBoundsException of Beeline.
> 
> 
> Diffs
> -----
> 
>   beeline/src/java/org/apache/hive/beeline/BeeLine.java 3482186 
> 
> Diff: https://reviews.apache.org/r/19322/diff/
> 
> 
> Testing
> -------
> 
> Manual test.  Now, in this scenario it will display the usage like:
> 
> beeline -u
> Usage: java org.apache.hive.cli.beeline.BeeLine 
>    -u <database url>               the JDBC URL to connect to
>    -n <username>                   the username to connect as
>    -p <password>                   the password to connect as
> ...
> 
> 
> Thanks,
> 
> Szehon Ho
> 
>


Re: Review Request 19322: HIVE-6685 Beeline throws ArrayIndexOutOfBoundsException for mismatched arguments

Posted by Xuefu Zhang <xz...@cloudera.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/19322/#review38657
-----------------------------------------------------------



beeline/src/java/org/apache/hive/beeline/BeeLine.java
<https://reviews.apache.org/r/19322/#comment70917>

    Could we log/print some message here? the exception seems just lost.


- Xuefu Zhang


On March 26, 2014, 7:42 p.m., Szehon Ho wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/19322/
> -----------------------------------------------------------
> 
> (Updated March 26, 2014, 7:42 p.m.)
> 
> 
> Review request for hive and Xuefu Zhang.
> 
> 
> Bugs: HIVE-6685
>     https://issues.apache.org/jira/browse/HIVE-6685
> 
> 
> Repository: hive-git
> 
> 
> Description
> -------
> 
> Improving the error-handling in ArrayIndexOutOfBoundsException of Beeline.
> 
> 
> Diffs
> -----
> 
>   beeline/src/java/org/apache/hive/beeline/BeeLine.java 1bd7af3 
>   beeline/src/test/org/apache/hive/beeline/TestBeelineArgParsing.java PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/19322/diff/
> 
> 
> Testing
> -------
> 
> Manual test.  Now, in this scenario it will display the usage like:
> 
> beeline -u
> Usage: java org.apache.hive.cli.beeline.BeeLine 
>    -u <database url>               the JDBC URL to connect to
>    -n <username>                   the username to connect as
>    -p <password>                   the password to connect as
> ...
> 
> 
> Thanks,
> 
> Szehon Ho
> 
>


Re: Review Request 19322: HIVE-6685 Beeline throws ArrayIndexOutOfBoundsException for mismatched arguments

Posted by Xuefu Zhang <xz...@cloudera.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/19322/#review38693
-----------------------------------------------------------

Ship it!


Ship It!

- Xuefu Zhang


On March 26, 2014, 8:32 p.m., Szehon Ho wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/19322/
> -----------------------------------------------------------
> 
> (Updated March 26, 2014, 8:32 p.m.)
> 
> 
> Review request for hive and Xuefu Zhang.
> 
> 
> Bugs: HIVE-6685
>     https://issues.apache.org/jira/browse/HIVE-6685
> 
> 
> Repository: hive-git
> 
> 
> Description
> -------
> 
> Improving the error-handling in ArrayIndexOutOfBoundsException of Beeline.
> 
> 
> Diffs
> -----
> 
>   beeline/src/java/org/apache/hive/beeline/BeeLine.java 1bd7af3 
>   beeline/src/test/org/apache/hive/beeline/TestBeelineArgParsing.java PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/19322/diff/
> 
> 
> Testing
> -------
> 
> Manual test.  Now, in this scenario it will display the usage like:
> 
> beeline -u
> Usage: java org.apache.hive.cli.beeline.BeeLine 
>    -u <database url>               the JDBC URL to connect to
>    -n <username>                   the username to connect as
>    -p <password>                   the password to connect as
> ...
> 
> 
> Thanks,
> 
> Szehon Ho
> 
>


Re: Review Request 19322: HIVE-6685 Beeline throws ArrayIndexOutOfBoundsException for mismatched arguments

Posted by Szehon Ho <sz...@cloudera.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/19322/
-----------------------------------------------------------

(Updated March 26, 2014, 8:32 p.m.)


Review request for hive and Xuefu Zhang.


Changes
-------

Printing the Parser's output message.  Now prints as follows:

$./bin/beeline -u szehon -p
Missing argument for option: p
Usage: java org.apache.hive.cli.beeline.BeeLine 
   -u <database url>               the JDBC URL to connect to
   -n <username>                   the username to connect as
   -p <password>                   the password to connect as
   -d <driver class>               the driver class to use
   -e <query>                      query that should be executed
   -f <file>                       script file that should be executed
   --hiveconf property=value       Use value for given property
   --hivevar name=value            hive variable name and value
                                   This is Hive specific settings in which variables
                                   can be set at session level and referenced in Hive
                                   commands or queries.
   --color=[true/false]            control whether color is used for display
   --showHeader=[true/false]       show column names in query results
   --headerInterval=ROWS;          the interval between which heades are displayed
   --fastConnect=[true/false]      skip building table/column list for tab-completion
   --autoCommit=[true/false]       enable/disable automatic transaction commit
   --verbose=[true/false]          show verbose error messages and debug info
   --showWarnings=[true/false]     display connection warnings
   --showNestedErrs=[true/false]   display nested errors
   --numberFormat=[pattern]        format numbers using DecimalFormat pattern
   --force=[true/false]            continue running script even after errors
   --maxWidth=MAXWIDTH             the maximum width of the terminal
   --maxColumnWidth=MAXCOLWIDTH    the maximum width to use when displaying columns
   --silent=[true/false]           be more silent
   --autosave=[true/false]         automatically save preferences
   --outputformat=[table/vertical/csv/tsv]   format mode for result display
   --isolation=LEVEL               set the transaction isolation level
   --nullemptystring=[true/false]  set to true to get historic behavior of printing null as empty string
   --help                          display this message


Bugs: HIVE-6685
    https://issues.apache.org/jira/browse/HIVE-6685


Repository: hive-git


Description
-------

Improving the error-handling in ArrayIndexOutOfBoundsException of Beeline.


Diffs (updated)
-----

  beeline/src/java/org/apache/hive/beeline/BeeLine.java 1bd7af3 
  beeline/src/test/org/apache/hive/beeline/TestBeelineArgParsing.java PRE-CREATION 

Diff: https://reviews.apache.org/r/19322/diff/


Testing
-------

Manual test.  Now, in this scenario it will display the usage like:

beeline -u
Usage: java org.apache.hive.cli.beeline.BeeLine 
   -u <database url>               the JDBC URL to connect to
   -n <username>                   the username to connect as
   -p <password>                   the password to connect as
...


Thanks,

Szehon Ho


Re: Review Request 19322: HIVE-6685 Beeline throws ArrayIndexOutOfBoundsException for mismatched arguments

Posted by Szehon Ho <sz...@cloudera.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/19322/
-----------------------------------------------------------

(Updated March 26, 2014, 7:42 p.m.)


Review request for hive and Xuefu Zhang.


Changes
-------

Rebasing and incorporating HIVE-6652 fix in the refactored code.


Bugs: HIVE-6685
    https://issues.apache.org/jira/browse/HIVE-6685


Repository: hive-git


Description
-------

Improving the error-handling in ArrayIndexOutOfBoundsException of Beeline.


Diffs (updated)
-----

  beeline/src/java/org/apache/hive/beeline/BeeLine.java 1bd7af3 
  beeline/src/test/org/apache/hive/beeline/TestBeelineArgParsing.java PRE-CREATION 

Diff: https://reviews.apache.org/r/19322/diff/


Testing
-------

Manual test.  Now, in this scenario it will display the usage like:

beeline -u
Usage: java org.apache.hive.cli.beeline.BeeLine 
   -u <database url>               the JDBC URL to connect to
   -n <username>                   the username to connect as
   -p <password>                   the password to connect as
...


Thanks,

Szehon Ho


Re: Review Request 19322: HIVE-6685 Beeline throws ArrayIndexOutOfBoundsException for mismatched arguments

Posted by Szehon Ho <sz...@cloudera.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/19322/
-----------------------------------------------------------

(Updated March 19, 2014, 1:25 a.m.)


Review request for hive and Xuefu Zhang.


Changes
-------

Refactored the arg-passing from manual list iteration, to use a simple extension of GNUParser.  Mostly borrowing the code from HiveCLI.

It is needed to extend the GNUParser because they dont support unknown arguments.  In beeline case, these are the 'property-files' and the reflectively-set BeelineOpts like 'autoCommit', etc.

Adding a unit test to verify the parsing doesn't break anything.


Bugs: HIVE-6685
    https://issues.apache.org/jira/browse/HIVE-6685


Repository: hive-git


Description
-------

Improving the error-handling in ArrayIndexOutOfBoundsException of Beeline.


Diffs (updated)
-----

  beeline/src/java/org/apache/hive/beeline/BeeLine.java 3482186 
  beeline/src/test/org/apache/hive/beeline/TestBeelineArgParsing.java PRE-CREATION 

Diff: https://reviews.apache.org/r/19322/diff/


Testing
-------

Manual test.  Now, in this scenario it will display the usage like:

beeline -u
Usage: java org.apache.hive.cli.beeline.BeeLine 
   -u <database url>               the JDBC URL to connect to
   -n <username>                   the username to connect as
   -p <password>                   the password to connect as
...


Thanks,

Szehon Ho


Re: Review Request 19322: HIVE-6685 Beeline throws ArrayIndexOutOfBoundsException for mismatched arguments

Posted by Szehon Ho <sz...@cloudera.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/19322/
-----------------------------------------------------------

(Updated March 17, 2014, 9:41 p.m.)


Review request for hive and Xuefu Zhang.


Bugs: HIVE-6685
    https://issues.apache.org/jira/browse/HIVE-6685


Repository: hive-git


Description
-------

Improving the error-handling in ArrayIndexOutOfBoundsException of Beeline.


Diffs
-----

  beeline/src/java/org/apache/hive/beeline/BeeLine.java 3482186 

Diff: https://reviews.apache.org/r/19322/diff/


Testing (updated)
-------

Manual test.  Now, in this scenario it will display the usage like:

beeline -u
Usage: java org.apache.hive.cli.beeline.BeeLine 
   -u <database url>               the JDBC URL to connect to
   -n <username>                   the username to connect as
   -p <password>                   the password to connect as
...


Thanks,

Szehon Ho