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

Unbalanced number of HiveParser msgs.push/msgs.pop calls when doing lookahead

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.13.0
    • Component/s: None
    • Labels:
      None

      Description

      HiveParser pushes/pops messages describing the current parse rule like so:

      joinSource
      @init { gParent.msgs.push("join source"); }
      @after { gParent.msgs.pop(); }
      ...
      

      The ANTLR generated code for the init/after actions looks like this:

               gParent.msgs.push("join source"); 
      ...
                  if ( state.backtracking==0 ) { gParent.msgs.pop(); }
      

      If we have a parse rule that does some lookahead, the message is always pushed onto the message stack since the init action has no check of state.backtracking. But that message is never popped because the after action does check state.backtracking. As a result there can be a bunch of parser context messages added to the stack which are never taken off.

        Attachments

        1. HIVE-6264.4.patch
          68 kB
          Jason Dere
        2. HIVE-6264.3.patch
          68 kB
          Jason Dere
        3. HIVE-6264.2.patch
          68 kB
          Jason Dere
        4. HIVE-6264.1.patch
          68 kB
          Jason Dere

          Activity

            People

            • Assignee:
              jdere Jason Dere
              Reporter:
              jdere Jason Dere
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: