malinjawi commented on code in PR #12647:
URL: https://github.com/apache/gluten/pull/12647#discussion_r4536220767
##########
backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala:
##########
@@ -179,20 +174,31 @@ class GlutenOptimisticTransaction(delegate:
OptimisticTransaction)
partitioningColumns,
metadata)
if (nativeUnsupportedReason.isEmpty) {
- GlutenDeltaFileFormatWriter.write(
- sparkSession = spark,
- plan = glutenPhysicalPlan(
- spark, empty2NullPlan, constraints, nativeInvariantChecker,
isOptimize, writeOptions),
- fileFormat = new GlutenDeltaParquetFileFormat(protocol, metadata),
- committer = committer,
- outputSpec = outputSpec,
- hadoopConf = jobHadoopConf,
- partitionColumns = partitioningColumns,
- bucketSpec = None,
- statsTrackers = optionalStatsTracker.toSeq
- ++ statsTrackers
- ++ identityTrackerOpt.toSeq,
- options = options)
+ val glutenPlan =
+ glutenPhysicalPlan(spark, empty2NullPlan, constraints, isOptimize,
writeOptions)
+ try {
+ GlutenDeltaFileFormatWriter.write(
+ sparkSession = spark,
+ plan = glutenPlan,
+ fileFormat = new GlutenDeltaParquetFileFormat(protocol,
metadata),
+ committer = committer,
+ outputSpec = outputSpec,
+ hadoopConf = jobHadoopConf,
+ partitionColumns = partitioningColumns,
+ bucketSpec = None,
+ statsTrackers = optionalStatsTracker.toSeq
+ ++ statsTrackers
+ ++ identityTrackerOpt.toSeq,
+ options = options)
+ } catch {
+ // Native code that pulls the checked batches keeps only a
violation's text, so find
+ // the violation the plan's checker threw. Delta's own catch below
handles the rest.
+ case NonFatal(e) if
InnerInvariantViolationException.unapply(e).isEmpty =>
+ val checker = glutenPlan.collectFirst {
+ case exec: GlutenDeltaInvariantCheckerExec => exec.checker
+ }
+ throw checker.flatMap(_.findViolation(e)).getOrElse(e)
Review Comment:
Done in 8c56429569. `findViolation` is static now: it reads the column name
from the NOT NULL violation's text and rebuilds Delta's exception, so the
transaction calls it directly. Thanks for the insight.
--
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]