rui-mo commented on code in PR #12064:
URL: https://github.com/apache/gluten/pull/12064#discussion_r3412333591
##########
gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/validator/Validators.scala:
##########
@@ -270,7 +270,24 @@ object Validators {
case p if HiveTableScanExecTransformer.isHiveTableScan(p) => true
case _ => false
}
- if (isScan) {
+ def ntzOnlyFromFileScans(p: SparkPlan): Boolean = {
+ if (!p.output.exists(a => containsNTZ(a.dataType))) {
+ true
+ } else {
+ p match {
+ case _: BatchScanExec => true
+ case _: FileSourceScanExec => true
+ case q if HiveTableScanExecTransformer.isHiveTableScan(q) => true
+ case _ if p.children.isEmpty => false
+ case _ => p.children.forall(ntzOnlyFromFileScans)
+ }
+ }
+ }
+ val outputHasNTZ = plan.output.exists(a => containsNTZ(a.dataType))
+ val writeChildHasNTZ = plan.isInstanceOf[WriteFilesExec] &&
+ plan.children.exists(_.output.exists(a => containsNTZ(a.dataType)))
+ val childNTZFromFileScans = plan.children.forall(ntzOnlyFromFileScans)
+ if (isScan || (!outputHasNTZ && !writeChildHasNTZ &&
childNTZFromFileScans)) {
Review Comment:
Since this PR only intends to enable Project for the `hour(timestamp_ntz)`
function, can we tighten the fallback condition to strictly check for that
specific case?
--
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]