KurtYoung commented on a change in pull request #8051: [FLINK-12018] [table-planner-blink] Add support for generating optimized logical plan for Sort and Rank URL: https://github.com/apache/flink/pull/8051#discussion_r270618484
########## File path: flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/plan/nodes/calcite/Rank.scala ########## @@ -34,44 +34,42 @@ import java.util import scala.collection.JavaConversions._ /** - * Relational expression that returns the rows in which the rank function value of each row + * Relational expression that returns the rows in which the rank number of each row * is in the given range. * - * <p>NOTES: Different from [[org.apache.calcite.sql.fun.SqlStdOperatorTable.RANK]], - * [[Rank]] is a Relational expression, not a window function. + * The node is an optimization of `OVER` for some special cases, + * e.g. + * {{{ + * SELECT * FROM ( + * SELECT a, b, RANK() OVER (PARTITION BY b ORDER BY c) rk FROM MyTable) t + * WHERE rk < 10 + * }}} + * can be converted to this node. * - * <p>[[Rank]] will output rank function value as its last column. - * - * <p>This RelNode only handles single rank function, is an optimization for some cases. e.g. - * <ol> - * <li> - * single rank function (on `OVER`) with filter in a SQL query statement - * </li> - * <li> - * `ORDER BY` with `LIMIT` in a SQL query statement - * (equivalent to `ROW_NUMBER` with filter and project) - * </li> - * </ol> - * - * @param cluster cluster that this relational expression belongs to - * @param traitSet the traits of this rel - * @param input input relational expression - * @param rankFunction rank function, including: CUME_DIST, DENSE_RANK, PERCENT_RANK, RANK, - * ROW_NUMBER - * @param partitionKey partition keys (may be empty) - * @param sortCollation order keys for rank function - * @param rankRange the expected range of rank function value + * @param cluster cluster that this relational expression belongs to + * @param traitSet the traits of this rel + * @param input input relational expression + * @param partitionKey partition keys (may be empty) Review comment: Can this be empty? ---------------------------------------------------------------- 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