[ 
https://issues.apache.org/jira/browse/HIVE-14606?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15435600#comment-15435600
 ] 

Vihang Karajgaonkar commented on HIVE-14606:
--------------------------------------------

Hi [~stakiar]
Overall LGTM.
Couple of comments below:
{noformat}
+            if (wasPrevEscape) {
+              wasPrevEscape = false;
+            } else {
+              wasPrevEscape = true;
+            }
{noformat}

could be changed to wasPrevEscape = !wasPrevEscape;

2. Is there a reason to use StringBuffer instead of StringBuilder? If not, lets 
use StringBuilder
3. Can you add the testcase for '\\'
4. some comments in the switch statement will be greatly helpful to understand 
the code faster.

Thanks for the change.

> Beeline fails if quoted string ends with \\
> -------------------------------------------
>
>                 Key: HIVE-14606
>                 URL: https://issues.apache.org/jira/browse/HIVE-14606
>             Project: Hive
>          Issue Type: Bug
>          Components: Beeline
>            Reporter: Sahil Takiar
>            Assignee: Sahil Takiar
>         Attachments: HIVE-14606.1.patch
>
>
> The following query fails in Beeline
> {code}
> select '\\' as literal;
> {code}
> Exception:
> {code}
> FAILED: ParseException line 1:22 extraneous input ';' expecting EOF near 
> '<EOF>'
> 16/08/22 15:46:15 [023ddb3b-1f3c-4db6-bd4e-bba392d6e4bb main]: ERROR 
> ql.Driver: FAILED: ParseException line 1:22 extraneous input ';' expecting 
> EOF near '<EOF>'
> org.apache.hadoop.hive.ql.parse.ParseException: line 1:22 extraneous input 
> ';' expecting EOF near '<EOF>'
>       at 
> org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:215)
>       at 
> org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:166)
>       at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:414)
>       at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:335)
>       at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1226)
>       at org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:1195)
>       at 
> org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:197)
>       at 
> org.apache.hive.service.cli.operation.SQLOperation.runInternal(SQLOperation.java:282)
>       at 
> org.apache.hive.service.cli.operation.Operation.run(Operation.java:324)
>       at 
> org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:497)
>       at 
> org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementAsync(HiveSessionImpl.java:485)
>       at 
> org.apache.hive.service.cli.CLIService.executeStatementAsync(CLIService.java:294)
>       at 
> org.apache.hive.service.cli.thrift.ThriftCLIService.ExecuteStatement(ThriftCLIService.java:505)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:498)
>       at 
> org.apache.hive.jdbc.HiveConnection$SynchronizedHandler.invoke(HiveConnection.java:1412)
>       at com.sun.proxy.$Proxy30.ExecuteStatement(Unknown Source)
>       at 
> org.apache.hive.jdbc.HiveStatement.runAsyncOnServer(HiveStatement.java:309)
>       at org.apache.hive.jdbc.HiveStatement.execute(HiveStatement.java:250)
>       at org.apache.hive.beeline.Commands.executeInternal(Commands.java:976)
>       at org.apache.hive.beeline.Commands.execute(Commands.java:1132)
>       at org.apache.hive.beeline.Commands.sql(Commands.java:1062)
>       at org.apache.hive.beeline.BeeLine.dispatch(BeeLine.java:1168)
>       at org.apache.hive.beeline.BeeLine.execute(BeeLine.java:999)
>       at org.apache.hive.beeline.BeeLine.begin(BeeLine.java:909)
>       at 
> org.apache.hive.beeline.BeeLine.mainWithInputRedirection(BeeLine.java:511)
>       at org.apache.hive.beeline.BeeLine.main(BeeLine.java:494)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:498)
>       at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
>       at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
> {code}
> This bug is a regression introduced by HIVE-12646



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to