liuyongvs commented on a change in pull request #9966: [FLINK-14053] 
[blink-planner] DenseRankAggFunction.accumulateExpressions. it should be thinki…
URL: https://github.com/apache/flink/pull/9966#discussion_r337447303
 
 

 ##########
 File path: 
flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/functions/aggfunctions/DenseRankAggFunction.java
 ##########
 @@ -67,8 +65,8 @@ public DenseRankAggFunction(InternalType[] orderKeyTypes) {
        @Override
        public Expression[] accumulateExpressions() {
                Expression[] accExpressions = new Expression[1 + 
operands().length];
-               // sequence = if (lastValues equalTo orderKeys) sequence else 
sequence + 1
-               accExpressions[0] = ifThenElse(orderKeyEqualsExpression(), 
sequence, plus(sequence, literal(1L)));
+               // sequence = if (lastValues equalTo orderKeys and sequence != 
0) sequence else sequence + 1
+               accExpressions[0] = ifThenElse(and(orderKeyEqualsExpression(), 
not(equalTo(sequence, literal(0L)))), sequence, plus(sequence, literal(1L)));
 
 Review comment:
   you scan see the unit test i commit. it will be zero rank

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to