You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Andrew Sherman (JIRA)" <ji...@apache.org> on 2017/06/23 20:19:00 UTC

[jira] [Commented] (HIVE-16935) Hive should strip comments from input before choosing which CommandProcessor to run.

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

Andrew Sherman commented on HIVE-16935:
---------------------------------------

h2. Description of Changes

We strip sql comments from a command string. The stripped command is use to determine which
CommandProcessor will execute the command. If the CommandProcessorFactory does not select a special
CommandProcessor then we execute the original unstripped command so that the sql parser can remove comments.
Move BeeLine's comment stripping code to HiveStringUtils and change BeeLine to call it from there
Add a better test with separate tokens for "set role" in TestCommandProcessorFactory.
Add a test case for comment removal in set_processor_namespaces.q  using an indented comment as
unindented comments are removed by the test driver.



> Hive should strip comments from input before choosing which CommandProcessor to run.
> ------------------------------------------------------------------------------------
>
>                 Key: HIVE-16935
>                 URL: https://issues.apache.org/jira/browse/HIVE-16935
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Andrew Sherman
>            Assignee: Andrew Sherman
>         Attachments: HIVE-16935.1.patch
>
>
> While using Beeswax, Hue fails to execute statement with following error:
> Error while compiling statement: FAILED: ParseException line 3:4 missing KW_ROLE at 'a' near 'a' line 3:5 missing EOF at '=' near 'a'
> {quote}
> -- comment
> SET a=1;
> SELECT 1;
> {quote}
> The same code works in Beeline and in Impala.
> The same code fails in CliDriver 
>  
> h2. Background
> Hive deals with sql comments (“-- to end of line”) in different places.
> Some clients attempt to strip comments. For example BeeLine was recently enhanced in https://issues.apache.org/jira/browse/HIVE-13864 to strip comments from multi-line commands before they are executed.
> Other clients such as Hue or Jdbc do not strip comments before sending text.
> Some tests such as TestCliDriver strip comments before running tests.
> When Hive gets a command the CommandProcessorFactory looks at the text to determine which CommandProcessor should handle the command. In the bug case the correct CommandProcessor is SetProcessor, but the comments confuse the CommandProcessorFactory and so the command is treated as sql. Hive’s sql parser understands and ignores comments, but it does not understand the set commands usually handled by SetProcessor and so we get the ParseException shown above.
>  



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)