flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [flink] KurtYoung commented on a change in pull request #8156: [FLINK-12168][table-planner-blink] Support e2e limit, sortLimit, rank, union in blink batch
Date Sun, 14 Apr 2019 08:46:57 GMT
KurtYoung commented on a change in pull request #8156: [FLINK-12168][table-planner-blink] Support
e2e limit, sortLimit, rank, union in blink batch
URL: https://github.com/apache/flink/pull/8156#discussion_r275146308
 
 

 ##########
 File path: flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/plan/nodes/physical/batch/BatchExecSortLimit.scala
 ##########
 @@ -92,4 +109,45 @@ class BatchExecSortLimit(
     costFactory.makeCost(rowCount, cpuCost, 0, 0, memCost)
   }
 
+  override def getDamBehavior: DamBehavior = DamBehavior.FULL_DAM
+
+  override def getInputNodes: util.List[ExecNode[BatchTableEnvironment, _]] =
+    List(getInput.asInstanceOf[ExecNode[BatchTableEnvironment, _]])
+
+  override def translateToPlanInternal(
+      tableEnv: BatchTableEnvironment): StreamTransformation[BaseRow] = {
+    if (limitEnd == Long.MaxValue) {
+      throw new TableException("Not support limitEnd is max value now!")
+    }
+
+    val input = getInputNodes.get(0).translateToPlan(tableEnv)
+        .asInstanceOf[StreamTransformation[BaseRow]]
+    val inputType = input.getOutputType.asInstanceOf[BaseRowTypeInfo]
+    val types = inputType.getFieldTypes.map(createInternalTypeFromTypeInfo)
+
+    // generate comparator
+    val generator = new SortCodeGenerator(
+      tableEnv.getConfig, keys, keys.map(types(_)), orders, nullsIsLast)
+
+    // TODO If input is ordered, there is no need to use the heap.
+    val operator = new SortLimitOperator(
+      isGlobal,
+      limitStart,
+      limitEnd,
+      generator.generateRecordComparator("SortLimitComparator"))
 
 Review comment:
   ditto

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message