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.