gengliangwang commented on code in PR #56378:
URL: https://github.com/apache/spark/pull/56378#discussion_r3389652408
##########
sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/txns.scala:
##########
@@ -279,6 +279,10 @@ class SharedTablesInMemoryRowLevelOperationTableCatalog
super.initialize(name, options)
tables = SharedTablesInMemoryRowLevelOperationTableCatalog.sharedTables
}
+
+ // Return the live table instance (not a snapshot copy) so that TRUNCATE and
DROP
+ // mutations affect the shared catalog state immediately.
Review Comment:
DROP doesn't actually flow through `loadTable` -- `DROP TABLE` resolves to a
`ResolvedIdentifier` and `DropTableExec` calls `tableExists`/`dropTable` (->
`tables.remove`), never loading or mutating a table object, so it's unaffected
by copy-vs-live. Only `TRUNCATE` (resolved as a `ResolvedTable` whose `table`
is mutated by `TruncateTableExec`) was broken here -- which matches your own
thread note that DROP uses `UnresolvedIdentifier`. Worth narrowing the comment
so a future reader doesn't infer DROP depends on this:
```suggestion
// Return the live table instance (not a snapshot copy) so that an
in-place TRUNCATE --
// which resolves its target via the read-path loadTable -- mutates the
shared catalog
// state instead of a discarded copy. (DROP bypasses loadTable, so it is
unaffected.)
```
--
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]