ulysses-you commented on code in PR #5963:
URL: https://github.com/apache/kyuubi/pull/5963#discussion_r1449695083
##########
externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/spark/sql/kyuubi/SparkDatasetHelper.scala:
##########
@@ -295,13 +294,21 @@ object SparkDatasetHelper extends Logging {
SQLMetrics.postDriverMetricUpdates(sc, executionId, metrics.values.toSeq)
}
+ private[kyuubi] def planLimit(plan: SparkPlan): Option[Int] = plan match {
+ case tp: TakeOrderedAndProjectExec => Option(tp.limit)
+ case c: CollectLimitExec => Option(c.limit)
+ case ap: AdaptiveSparkPlanExec => planLimit(ap.inputPlan)
+ case _ => None
+ }
+
def shouldSaveResultToFs(resultMaxRows: Int, minSize: Long, result:
DataFrame): Boolean = {
if (isCommandExec(result.queryExecution.executedPlan.nodeName)) {
return false
}
- lazy val limit = result.queryExecution.executedPlan match {
- case collectLimit: CollectLimitExec => collectLimit.limit
- case _ => resultMaxRows
+ val limit = planLimit(result.queryExecution.executedPlan) match {
Review Comment:
it seems it's more simpler to match a logical limit
--
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]