longvu-db opened a new pull request, #55577:
URL: https://github.com/apache/spark/pull/55577

   ### What changes were proposed in this pull request?
   
   Add DSv2 CACHE TABLE test coverage for Spark Connect in a new 
`DataSourceV2CacheConnectSuite`.
   
   The tests use an in-process Connect server (`SparkConnectServerTest`) so 
that a Connect client performs cache and SQL operations, while external writes 
go through the catalog API (`InMemoryBaseTable.withData`), which bypasses the 
`CacheManager`. This simulates a truly external writer whose changes are 
invisible to cached reads.
   
   **New tests:**
   - **Scenario 1+2** (`"CACHE TABLE pins state; session write invalidates, 
external does not"`): External data write via catalog API is invisible to the 
cached table. Session INSERT invalidates and recaches. Subsequent external 
write is again invisible.
   - **Scenario 3** (`"cached table pinned against external schema change"`): 
External ADD COLUMN via catalog API is invisible to the cached table.
   - **Scenario 4** (`"session schema change invalidates cache, external write 
invisible"`): Session `ALTER TABLE ADD COLUMN` via Connect invalidates and 
rebuilds cache with the new 3-column schema.
   - **Scenario 5** (`"cached table after external drop and recreate sees empty 
table"`): External drop+recreate via catalog API produces a new table with a 
different ID; query sees the new empty table.
   
   ### Why are the changes needed?
   
   The classic (non-Connect) CACHE TABLE tests in `DataSourceV2DataFrameSuite` 
verify cache pinning behavior using direct catalog API access. This PR adds the 
equivalent coverage for Spark Connect, ensuring that cache pinning works 
correctly when operations flow through the Connect protocol.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. This PR only adds tests.
   
   ### How was this patch tested?
   
   New tests in `DataSourceV2CacheConnectSuite` (all 4 tests pass).
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (claude-opus-4-6)


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