Mariamalmesfer commented on code in PR #12064:
URL: https://github.com/apache/gluten/pull/12064#discussion_r3412428862
##########
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:
good point, replaced the broad `ntzOnlyFromFileScans` logic with
`isHourOnNtz` check that only allows `Hour` expressions on NTZ columns through
--
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]