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_r270710882
 
 

 ##########
 File path: 
flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/plan/nodes/calcite/Rank.scala
 ##########
 @@ -91,10 +89,13 @@ abstract class Rank(
   }
 
   override def deriveRowType(): RelDataType = {
+    if (!outputRankNumber) {
+      return input.getRowType
+    }
     val typeFactory = cluster.getRexBuilder.getTypeFactory
     val typeBuilder = typeFactory.builder()
     input.getRowType.getFieldList.foreach(typeBuilder.add)
-    // rank function column is always the last column, and its type is BIGINT 
NOT NULL
+    // rank number column is always the last column, and its type is BIGINT 
NOT NULL
     val allFieldNames = new util.HashSet[String]()
     allFieldNames.addAll(input.getRowType.getFieldNames)
     val rankFieldName = FlinkRelOptUtil.buildUniqueFieldName(allFieldNames, 
"rk")
 
 Review comment:
   actually, I find that the rank number field name may be dropped in 
`ProjectToWindowRule`, and be changed to name like `w0$oi`. so, I think we can 
keep current implementation and add a `TODO` to solve this later.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to