godfreyhe 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_r270701308
########## File path: flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/plan/util/FlinkRelOptUtil.scala ########## @@ -248,4 +251,262 @@ object FlinkRelOptUtil { } } + private[this] case class LimitPredicate(rankOnLeftSide: Boolean, pred: RexCall) + + private[this] sealed trait Boundary + + private[this] case class LowerBoundary(lower: Long) extends Boundary + + private[this] case class UpperBoundary(upper: Long) extends Boundary + + private[this] case class BothBoundary(lower: Long, upper: Long) extends Boundary + + private[this] case class InputRefBoundary(inputFieldIndex: Int) extends Boundary + + private[this] sealed trait BoundDefine + + private[this] object Lower extends BoundDefine // defined lower bound + private[this] object Upper extends BoundDefine // defined upper bound + private[this] object Both extends BoundDefine // defined lower and uppper bound + + /** + * Extracts the TopN offset and fetch bounds from a predicate. + * + * @param predicate predicate + * @param rankFieldIndex the index of rank field + * @param rexBuilder RexBuilder + * @param config TableConfig + * @return A Tuple2 of extracted rank range and remaining predicates. + */ + def extractRankRange( Review comment: OK ---------------------------------------------------------------- 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