alekjarmov opened a new pull request, #59505:
URL: https://github.com/apache/spark/pull/59505

   ### What changes were proposed in this pull request?
   
   `REFRESH` / table-exists / schema resolution against Oracle can fail 
completely when JDBC `getTables` lists a synonym whose target no longer exists. 
Resolving that synonym (`SELECT * FROM <synonym> WHERE 1=0`) raises `ORA-00980: 
synonym translation is no longer valid` (SQLSTATE `42000`).
   
   `OracleDialect` already treats `ORA-04044` (synonym to a procedure/function) 
and `ORA-04063` (invalid view) as not-selectable. `ORA-00980` was unclassified, 
so `JDBCRDD.resolveTable` fell through to `isSyntaxErrorBestEffort` (SQLSTATE 
`42000`) and threw 
`JDBC_EXTERNAL_ENGINE_SYNTAX_ERROR.DURING_OUTPUT_SCHEMA_RESOLUTION`, aborting 
catalog/schema refresh.
   
   This PR adds `ORA-00980` to `OracleDialect.isNotSelectableObjectException`. 
The broken synonym then raises `JDBC_OBJECT_NOT_SELECTABLE`, which existing 
JDBC catalog load paths already treat as a missing table, so refresh skips the 
synonym and continues with remaining tables and views.
   
   `ORA-00980` is deterministic: Oracle raises it only when a synonym's target 
cannot be resolved. A missing or inaccessible base object behind a valid name 
still raises `ORA-00942`, which stays classified as not-found.
   
   ### Why are the changes needed?
   
   One dangling Oracle synonym currently fails the entire JDBC catalog/schema 
refresh instead of being skipped like other non-selectable objects (`ORA-04044` 
/ `ORA-04063`).
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, for JDBC against Oracle: a synonym whose target is missing is now 
treated as not selectable (`JDBC_OBJECT_NOT_SELECTABLE` / treated as absent for 
existence checks) instead of failing schema resolution with 
`JDBC_EXTERNAL_ENGINE_SYNTAX_ERROR.DURING_OUTPUT_SCHEMA_RESOLUTION`.
   
   ### How was this patch tested?
   
   - Unit test in `JDBCSuite` covering `ORA-00980` / `ORA-04044` / `ORA-04063` 
vs `ORA-00942` and a genuine syntax error.
   - New case in the existing `OracleIntegrationSuite` SPARK-57778 docker grid 
(`CREATE SYNONYM` for a missing table).
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Cursor Grok 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