Github user twalthr commented on a diff in the pull request: https://github.com/apache/flink/pull/2282#discussion_r73181770 --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/api/table/plan/nodes/dataset/DataSetSort.scala --- @@ -71,11 +78,57 @@ class DataSetSort( partitionedDs = partitionedDs.sortPartition(fieldCollation._1, fieldCollation._2) } + val offsetAndFetchDS = if (offset != null) { + val offsetIndex = RexLiteral.intValue(offset) + val fetchIndex = if (fetch != null) { + RexLiteral.intValue(fetch) + offsetIndex + } else { + Int.MaxValue + } + if (currentParallelism != 1) { + val partitionCount = partitionedDs.mapPartition( + new MapPartitionFunction[Any, Int] { + override def mapPartition(value: lang.Iterable[Any], out: Collector[Int]): Unit = { + val iterator = value.iterator() + var elementCount = 0 + while (iterator.hasNext) { + elementCount += 1 + iterator -> iterator.next() + } + out.collect(elementCount) + } + }).collect().asScala --- End diff -- This triggers multiple jobs. I don't know if we want that. Isn't there a better way to do it?
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---