yyanyy commented on code in PR #57865:
URL: https://github.com/apache/spark/pull/57865#discussion_r3799426710


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/RelationResolution.scala:
##########
@@ -236,15 +246,18 @@ class RelationResolution(
         val planId = u.getTagValue(LogicalPlan.PLAN_ID_TAG)
         val writePrivileges = 
u.options.get(UnresolvedRelation.REQUIRED_WRITE_PRIVILEGES)
         val finalOptions = u.clearWritePrivileges.options
-        // Time travel applies to reads only; reject it on a write target 
(reachable via the option
-        // form, e.g. `INSERT INTO t WITH ('versionAsOf' = ...)`) with a 
user-facing error.
+        if (writePrivileges != null) {
+          CatalogV2Util.rejectTimeTravelOptionsForWrite(catalog, ident, 
finalOptions)
+        }
+        // Time travel applies to reads only; reject an explicit time-travel 
specification on a
+        // write target with a user-facing error.
         if (finalTimeTravelSpec.nonEmpty && writePrivileges != null) {
           throw 
QueryCompilationErrors.timeTravelUnsupportedError(toSQLId(identifier))

Review Comment:
   thanks, addressed to use the same catalog-qualified identifier. I kept the 
branch since `RelationResolution`’s internal API can receive an explicit 
`TimeTravelSpec` for a write target even though the public SQL/DataFrame 
frontends do not currently construct that path (e.g. 
`resolveRelation(write.requireWritePrivileges(INSERT), 
Some(AsOfVersion("v1")))`); added a regression test for it



-- 
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]

Reply via email to