You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "jackylau (Jira)" <ji...@apache.org> on 2019/09/11 12:17:00 UTC
[jira] [Commented] (FLINK-14053) blink planner dense_rank corner
case bug
[ https://issues.apache.org/jira/browse/FLINK-14053?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16927516#comment-16927516 ]
jackylau commented on FLINK-14053:
----------------------------------
[~jark] it is a bug in DenseRankAggFunction.accumulateExpressions. it should be thinking about a corner case when the order by expression equals to inital lastValue.
it should be fix at form below. could I commit a PR ?
accExpressions[0] = ifThenElse(and(orderKeyEqualsExpression(), not(equalTo(sequence, literal(0L)))), sequence, plus(sequence, literal(1L)));
> blink planner dense_rank corner case bug
> ----------------------------------------
>
> Key: FLINK-14053
> URL: https://issues.apache.org/jira/browse/FLINK-14053
> Project: Flink
> Issue Type: Bug
> Components: Table SQL / Planner
> Affects Versions: 1.9.0
> Reporter: jackylau
> Priority: Major
> Fix For: 1.10.0
>
>
> sql :
> val rank =
> """
> |SELECT
> | gradeId,
> | classId,
> | stuId,
> | score,
> | dense_rank() OVER (PARTITION BY gradeId, classId ORDER BY score asc) as dense_rank_num
> |FROM student
> |
> """.stripMargin
> sample date:
> row("grade2", "class2", "0006", 90),
> row("grade1", "class2", "0007", 90),
> row("grade1", "class1", "0001", 95),
> row("grade1", "class1", "0002", 94),
> row("grade1", "class1", "0003", 97),
> row("grade1", "class1", "0004", 95),
> row("grade1", "class1", "0005", 0)
> the dense_rank ranks from 0, but it should be from 1
>
--
This message was sent by Atlassian Jira
(v8.3.2#803003)