cloud-fan opened a new pull request, #53858:
URL: https://github.com/apache/spark/pull/53858

   ### What changes were proposed in this pull request?
   
   This PR optimizes the DROP TABLE command to reduce the number of Hive RPC 
calls by:
   
   1. **Override `tableExists` in `V2SessionCatalog`** to directly call 
`SessionCatalog.tableExists` instead of going through `loadTable` which incurs 
extra `requireDbExists` checks.
   
   2. **Remove redundant checks in `SessionCatalog.getTableRawMetadata`** - 
removed `requireDbExists` and `requireTableExists` calls, letting 
`ExternalCatalog.getTable` handle error reporting.
   
   3. **Remove `requireDbExists` from `HiveExternalCatalog.dropTable`** - the 
database existence check is now handled at the lowest layer.
   
   4. **Update `HiveClientImpl.dropTable`** to handle missing database/table 
cases properly with optimistic exception handling.
   
   5. **Update `HiveClient.getTable` and `getRawHiveTable`** to throw 
`NoSuchTableException` with fully qualified names (including catalog name).
   
   6. **Update `InMemoryCatalog.dropTable`** to handle missing database case 
consistently.
   
   ### Why are the changes needed?
   
   Before this change, DROP TABLE on an existing table made 10 Hive client 
calls. After this change, it only makes 3 calls:
   1. `tableExists` (in DropTableExec to check if table exists)
   2. `getTable` (to get table metadata)
   3. `dropTable` (the actual drop operation)
   
   For non-existent tables, it now only makes 1 call (just `tableExists`).
   
   ### Does this PR introduce _any_ user-facing change?
   
   No, the behavior is the same. Only internal RPC calls are reduced.
   
   ### How was this patch tested?
   
   Updated and extended existing tests in:
   - `ExternalCatalogSuite`
   - `SessionCatalogSuite`
   - `DropTableSuiteBase`
   - `DropTableSuite` (hive)
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Yes.


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