felipepessoto commented on code in PR #13510:
URL: https://github.com/apache/gluten/pull/13510#discussion_r4653772886
##########
backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsTracker.scala:
##########
@@ -72,13 +74,31 @@ private[stats] class GlutenDeltaJobStatsTracker(val
delegate: DeltaJobStatistics
private val dataCols = delegate.dataCols
private val statsColExpr = delegate.statsColExpr
- private val srlHadoopConf = new SerializableConfiguration(hadoopConf)
private val rootUri =
path.getFileSystem(hadoopConf).makeQualified(path).toUri
override def newTaskInstance(): WriteTaskStatsTracker = {
- val rootPath = new Path(rootUri)
- val hadoopConf = srlHadoopConf.value
- new GlutenDeltaTaskStatsTracker(dataCols, statsColExpr, rootPath,
hadoopConf)
+ val aggregates = statsColExpr.collect {
+ case ae: AggregateExpression if
ae.aggregateFunction.isInstanceOf[DeclarativeAggregate] =>
+ assert(ae.mode == Complete)
+ ae
+ }
+ val plan = createStatsPlan(dataCols, aggregates)
+ plan match {
+ case WholeStageTransformer(child: TransformSupport, _) if
supportsNativeStats(child) =>
+ if (Utils.isTesting) {
+ statsPlanObserver.foreach(_(new Path(rootUri), child))
+ }
+ new GlutenDeltaTaskStatsTracker(statsColExpr, aggregates, child)
+ case _ =>
+ val reasons = plan
+ .flatMap(node => FallbackTags.getOption(node).map(_.reason()))
+ .distinct
+ .mkString("; ")
+ logWarning(
+ "Gluten Delta: Statistics plan could not be fully offloaded. Falling
back to " +
+ s"row-based Delta statistics with columnar-to-row conversion.
$reasons")
Review Comment:
Yes, `GlutenExplainUtils.visitFallbackNodes` already does this. In 00d46abdc
I switched both Delta trackers to use it for the warning, instead of walking
the plan and reading fallback tags themselves. The check for whether the whole
statistics stage can run natively is unchanged.
--
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]