Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -599,12 +599,13 @@ class DateFunctionsValidateSuite extends FunctionsValidateSuite {
checkGlutenPlan[BatchScanExecTransformer]
}

// Ensures the fallback of unsupported function works.
// hour(timestamp_ntz) runs natively; output is int (no NTZ propagation).
runQueryAndCompare("select hour(ts) from view") {
df =>
assert(collect(df.queryExecution.executedPlan) {
case p if p.isInstanceOf[ProjectExec] => p
}.nonEmpty)
checkGlutenPlan[ProjectExecTransformer]
}
// timestampadd(timestamp_ntz) runs natively; NTZ flows through from file scan.
runQueryAndCompare("select timestampadd('hour', 1, ts) from view") {
checkGlutenPlan[ProjectExecTransformer]
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion ep/build-velox/src/get-velox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ RUN_SETUP_SCRIPT=ON
ENABLE_ENHANCED_FEATURES=OFF

# Developer use only for testing Velox PR.
UPSTREAM_VELOX_PR_ID=""
UPSTREAM_VELOX_PR_ID="17800"

OS=`uname -s`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,25 @@ 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)
val ntzFlowsThrough = plan.children.exists(_.output.exists(a => containsNTZ(a.dataType)))
if (isScan || (!writeChildHasNTZ && childNTZFromFileScans && (!outputHasNTZ || ntzFlowsThrough))) {
return pass()
}
}
Expand Down
Loading