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

MatchPath misses the last matched row from the final result set

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.2.0
    • 1.3.0, 2.0.0
    • UDF
    • None

    Description

      For example, if you have a STAR pattern at the end, the current code misses the last row from the final result. For example, if I have pattern like (LATE.EARLY*), the matched rows are :
      1. LATE
      2. EARLY
      In the current implementation, the final 'tpath' missed the last "EARLY" and returns only LATE . Ideally it should return LATE and EARLY.

      The following code snippets shows the bug.

      0. SymbolFunctionResult rowResult = symbolFn.match(row, pItr);
      1. while (rowResult.matches && pItr.hasNext())
      2.    {
      3.      row = pItr.next();
      4.        rowResult = symbolFn.match(row, pItr);
      5.      }
      6.
      7.      result.nextRow = pItr.getIndex() - 1;
      

      Line 7 of the code always moves the row index by one. If ,in some cases, loop (line 1) is never executed (due to pItr.hasNext() being 'false'), the code still moves the row pointer back by one. Although the line 0 found the first match and the iterator reaches to the end.

      I'm uploading a patch which I already tested.

      Attachments

        1. HIVE-10787.1.patch
          0.6 kB
          Mohammad Islam

        Activity

          People

            kamrul Mohammad Islam
            kamrul Mohammad Islam
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: