Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-16935

Hive should strip comments from input before choosing which CommandProcessor to run.

Log workAgile BoardRank to TopRank to BottomBulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments


    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 3.0.0
    • None
    • None


      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'

      – comment
      SET a=1;
      SELECT 1;

      The same code works in Beeline and in Impala.
      The same code fails in CliDriver


      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.


        1. HIVE-16935.1.patch
          17 kB
          Andrew Sherman
        2. HIVE-16935.2.patch
          20 kB
          Andrew Sherman
        3. HIVE-16935.3.patch
          20 kB
          Andrew Sherman
        4. HIVE-16935.4.patch
          21 kB
          Andrew Sherman

        Issue Links


          This comment will be Viewable by All Users Viewable by All Users


            asherman Andrew Sherman Assign to me
            asherman Andrew Sherman
            0 Vote for this issue
            5 Start watching this issue




                Issue deployment