pan3793 commented on code in PR #5591:
URL: https://github.com/apache/kyuubi/pull/5591#discussion_r1393645302
##########
externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/spark/sql/kyuubi/SparkDatasetHelper.scala:
##########
@@ -278,4 +279,34 @@ object SparkDatasetHelper extends Logging {
val executionId = sc.getLocalProperty(SQLExecution.EXECUTION_ID_KEY)
SQLMetrics.postDriverMetricUpdates(sc, executionId, metrics.values.toSeq)
}
+
+ def shouldSaveResultToHdfs(resultMaxRows: Int, threshold: Int, result:
DataFrame): Boolean = {
+ lazy val limit = result.queryExecution.executedPlan match {
+ case plan if isCommandExec(plan.nodeName) => 0
+ case collectLimit: CollectLimitExec => collectLimit.limit
+ case _ => resultMaxRows
+ }
+ lazy val stats = if (limit > 0) {
+ limit * EstimationUtils.getSizePerRow(
+ result.queryExecution.executedPlan.output)
+ } else {
+ result.queryExecution.optimizedPlan.stats.sizeInBytes
+ }
+ lazy val isSort = result.queryExecution.sparkPlan match {
+ case SortExec(_, global, _, _) if global => true
Review Comment:
is it binary-compatible across different spark versions? we must ensure that
engine jar built against spark 3.4 also works on spark 3.1 ~ 3.5 runtimes
--
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]