vinodkc commented on code in PR #41899:
URL: https://github.com/apache/spark/pull/41899#discussion_r1276606563
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/window/WindowGroupLimitExec.scala:
##########
@@ -73,26 +73,23 @@ case class WindowGroupLimitExec(
protected override def doExecute(): RDD[InternalRow] = {
val numOutputRows = longMetric("numOutputRows")
- rankLikeFunction match {
- case _: RowNumber if partitionSpec.isEmpty =>
- child.execute().mapPartitionsInternal(SimpleLimitIterator(_, limit,
numOutputRows))
- case _: RowNumber =>
- child.execute().mapPartitionsInternal(new GroupedLimitIterator(_,
output, partitionSpec,
- (input: Iterator[InternalRow]) => SimpleLimitIterator(input, limit,
numOutputRows)))
- case _: Rank if partitionSpec.isEmpty =>
- child.execute().mapPartitionsInternal(
- RankLimitIterator(output, _, orderSpec, limit, numOutputRows))
- case _: Rank =>
- child.execute().mapPartitionsInternal(new GroupedLimitIterator(_,
output, partitionSpec,
- (input: Iterator[InternalRow]) =>
- RankLimitIterator(output, input, orderSpec, limit, numOutputRows)))
- case _: DenseRank if partitionSpec.isEmpty =>
- child.execute().mapPartitionsInternal(
- DenseRankLimitIterator(output, _, orderSpec, limit, numOutputRows))
- case _: DenseRank =>
- child.execute().mapPartitionsInternal(new GroupedLimitIterator(_,
output, partitionSpec,
- (input: Iterator[InternalRow]) =>
- DenseRankLimitIterator(output, input, orderSpec, limit,
numOutputRows)))
+
+ val evaluatorFactory =
+ new WindowGroupLimitEvaluatorFactory(
+ partitionSpec,
+ orderSpec,
+ rankLikeFunction,
+ limit,
+ child.output,
+ numOutputRows)
+
+ if (conf.usePartitionEvaluator) {
+ child.execute().mapPartitionsWithEvaluator(evaluatorFactory)
+ } else {
+ child.execute().mapPartitionsInternal { iter =>
+ val evaluator = evaluatorFactory.createEvaluator()
+ evaluator.eval(0, iter)
Review Comment:
@beliefer, Can you please raise a follow-up PR to handle the partition index
as this https://github.com/apache/spark/pull/42185
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]