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

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 0.13.0
    • None
    • 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.1.patch
          68 kB
          Jason Dere
        2. HIVE-6264.2.patch
          68 kB
          Jason Dere
        3. HIVE-6264.3.patch
          68 kB
          Jason Dere
        4. HIVE-6264.4.patch
          68 kB
          Jason Dere

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: