Mohammad Kamrul Islam created HIVE-10787:
--------------------------------------------
Summary: MatchPath misses the last matched row from the final
result set
Key: HIVE-10787
URL: https://issues.apache.org/jira/browse/HIVE-10787
Project: Hive
Issue Type: Bug
Components: UDF
Affects Versions: 1.2.0
Reporter: Mohammad Kamrul Islam
Assignee: Mohammad Kamrul Islam
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.
{noformat}
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;
{noformat}
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.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)