cloud-fan commented on a change in pull request #34738:
URL: https://github.com/apache/spark/pull/34738#discussion_r765776937
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/DataSourceScanExec.scala
##########
@@ -142,13 +142,25 @@ case class RowDataSourceScanExec(
handledFilters
}
+ val optionOutputMap =
+ if (pushedDownOperators.limit.isDefined &&
pushedDownOperators.sortValues.nonEmpty) {
+ val pushedTopN =
+ s"""
+ |ORDER BY
${seqToString(pushedDownOperators.sortValues.map(_.describe()))}
+ |LIMIT ${pushedDownOperators.limit.get}
+ |""".stripMargin
+ Map("pushedTopN" -> pushedTopN)
+ } else {
+ pushedDownOperators.aggregation.fold(Map[String, String]()) { v =>
+ Map("PushedAggregates" -> seqToString(v.aggregateExpressions),
+ "PushedGroupByColumns" -> seqToString(v.groupByColumns))} ++
+ pushedDownOperators.limit.map(value => "PushedLimit" -> s"LIMIT
$value")
+ }
+
Map(
"ReadSchema" -> requiredSchema.catalogString,
"PushedFilters" -> seqToString(markedFilters.toSeq)) ++
- pushedDownOperators.aggregation.fold(Map[String, String]()) { v =>
- Map("PushedAggregates" -> seqToString(v.aggregateExpressions),
- "PushedGroupByColumns" -> seqToString(v.groupByColumns))} ++
- pushedDownOperators.limit.map(value => "PushedLimit" -> s"LIMIT $value")
++
Review comment:
Why do we remove them? I think we should just append the top n
information
```
val topNInfo = if (pushedDownOperators.limit.isDefined &&
pushedDownOperators.sortValues.nonEmpty) {
Some(.. -> ...)
} else {
None
}
...
pushedDownOperators.limit.map(value => "PushedLimit" -> s"LIMIT $value") ++
topNInfo ++
```
--
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]