You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Jark Wu (Jira)" <ji...@apache.org> on 2022/03/23 14:22:00 UTC

[jira] [Commented] (FLINK-26819) AppendOnlyFirstNFunction produce wrong result when with offset and without rank number

    [ https://issues.apache.org/jira/browse/FLINK-26819?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17511277#comment-17511277 ] 

Jark Wu commented on FLINK-26819:
---------------------------------

[~lincoln.86xy] could you open pull requests to backport the fix to release-1.15 and release-1.14 branches?

> AppendOnlyFirstNFunction produce wrong result when with offset and without rank number
> --------------------------------------------------------------------------------------
>
>                 Key: FLINK-26819
>                 URL: https://issues.apache.org/jira/browse/FLINK-26819
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Runtime
>    Affects Versions: 1.15.0, 1.14.4
>            Reporter: lincoln lee
>            Assignee: lincoln lee
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.16.0
>
>
> FLINK-19896 introduced an optimized AppendOnlyFirstNFunction, but produces wrong result when a constant rank with offset and without rank number.
> In test case `AppendOnlyFirstNFunctionTest.testConstantRankRangeWithOffset` produces 4 output while 2 output is expected because only want rank range be [2,2]
> {code}
>         AbstractTopNFunction func =
>                 createFunction(RankType.ROW_NUMBER, new ConstantRankRange(2, 2), true, false);
>         OneInputStreamOperatorTestHarness<RowData, RowData> testHarness = createTestHarness(func);
>         testHarness.open();
>         testHarness.processElement(insertRecord("book", 2L, 12));
>         testHarness.processElement(insertRecord("book", 2L, 19));
>         testHarness.processElement(insertRecord("book", 2L, 11));
>         testHarness.processElement(insertRecord("fruit", 1L, 33));
>         testHarness.processElement(insertRecord("fruit", 1L, 44));
>         testHarness.processElement(insertRecord("fruit", 1L, 22));
>         testHarness.close();
>         List<Object> expectedOutput = new ArrayList<>();
>         expectedOutput.add(insertRecord("book", 2L, 12));
>         expectedOutput.add(insertRecord("book", 2L, 19));
>         expectedOutput.add(insertRecord("fruit", 1L, 33));
>         expectedOutput.add(insertRecord("fruit", 1L, 44));
>        ...
> {code}
> we should fix this.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)