hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Vary <pv...@cloudera.com>
Subject Re: Review Request 49655: HIVE-12646: beeline and HIVE CLI do not parse ; in quote properly
Date Wed, 13 Jul 2016 08:37:13 GMT

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



Thanks for your patch!
This was a very annoying "feature" :)

As discussed offline, please look at DDLTask.java where the SHOW CREATE TABLE command is implemented.
There is an escapeHiveCommand method, which escapes the result which is expected to be copy/pasted
back to command line and executed without change.

Another thing your patch should consider, that the comment fields could contain escaped '
characters, like the one below:

```
create table escape_comments_tbl1 (col1 string comment 'ab\';\');
```

Thanks,
Peter

- Peter Vary


On July 12, 2016, 4:04 a.m., Sahil Takiar wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/49655/
> -----------------------------------------------------------
> 
> (Updated July 12, 2016, 4:04 a.m.)
> 
> 
> Review request for hive, Sergio Pena and Yongzhi Chen.
> 
> 
> Bugs: HIVE-12646
>     https://issues.apache.org/jira/browse/HIVE-12646
> 
> 
> Repository: hive-git
> 
> 
> Description
> -------
> 
> HIVE-12646: beeline and HIVE CLI do not parse ; in quote properly
> 
> Approach:
> 
>   * Modified the `Commands.execute(...)` command to iterate throught the given input
line character by character
>   * It looks for single and double quotes in order to track when the iterator is inside
a quotation block
>   * If the iterator is inside a quotation block and it finds a semicolon, it ignores
it, otherwise it treats it as it normally would
>   * Moved the logic for parsing the line into a helper method called `getCmList(...)`
which is responsible for returning a `List` of commands that need to be run
> 
> 
> Diffs
> -----
> 
>   beeline/src/java/org/apache/hive/beeline/Commands.java 3a204c0 
>   itests/hive-unit/src/test/java/org/apache/hive/beeline/TestBeeLineWithArgs.java ecfeddb

> 
> Diff: https://reviews.apache.org/r/49655/diff/
> 
> 
> Testing
> -------
> 
> Add a unit tests which checks that Beeline can successfully run queries that contain
semi-colons inside quotation blocks. Confirmed existing unit tests pass.
> 
> 
> Thanks,
> 
> Sahil Takiar
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message