You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "alekjarmov (via GitHub)" <gi...@apache.org> on 2026/10/15 10:45:39 UTC

[PR] [SQL] Treat Oracle broken synonyms (ORA-00980) as not selectable [spark]

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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-60259][SQL] Treat Oracle broken synonyms (ORA-00980) as not selectable [spark]

Posted by "urosstan-db (via GitHub)" <gi...@apache.org>.
urosstan-db commented on PR #59505:
URL: https://github.com/apache/spark/pull/59505#issuecomment-6197496230

   /dismiss


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-60259][SQL] Treat Oracle broken synonyms (ORA-00980) as not selectable [spark]

Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on PR #59505:
URL: https://github.com/apache/spark/pull/59505#issuecomment-6232594064

   **Merge Summary:**
   - merged into master https://github.com/apache/spark/commit/3ae7bd4dd0035b2677142c50e22b96b377e4da60
   - merged into branch-4.x https://github.com/apache/spark/commit/633c0ab93d6190eb29c57a1cdf3342e3c7dc0433
   
   *Posted by `merge_spark_pr.py`*


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-60259][SQL] Treat Oracle broken synonyms (ORA-00980) as not selectable [spark]

Posted by "alekjarmov (via GitHub)" <gi...@apache.org>.
alekjarmov commented on PR #59505:
URL: https://github.com/apache/spark/pull/59505#issuecomment-6198801186

   Thanks @cloud-fan. The write path is intended to keep the existing not-selectable behavior: existence checks treat the object as absent, so V1 `DataFrameWriter.jdbc` and catalog `CREATE TABLE IF NOT EXISTS` / CTAS proceed to `CREATE TABLE` instead of failing with ORA-00980. An unqualified public synonym creates a local table that shadows it; a private synonym still fails at CREATE with ORA-00955. That is the same as ORA-04044 / ORA-04063 since SPARK-57778. I updated the user-facing section of the PR description to say so.


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-60259][SQL] Treat Oracle broken synonyms (ORA-00980) as not selectable [spark]

Posted by "urosstan-db (via GitHub)" <gi...@apache.org>.
urosstan-db commented on code in PR #59505:
URL: https://github.com/apache/spark/pull/59505#discussion_r4285150868


##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala:
##########
@@ -819,9 +819,9 @@ abstract class JdbcDialect extends Serializable with Logging {
 
   /**
    * Returns true if the given exception indicates the object exists but cannot be read as a
-   * table or view (e.g. a synonym that resolves to a procedure, or an invalid view), as opposed
-   * to not existing at all (see `isObjectNotFoundException`). Dialects override this to recognize
-   * their own error codes; the default is false.
+   * table or view (e.g. a synonym that resolves to a procedure or a missing object, or an

Review Comment:
   nit: why we need to docs change, since this is public API docs, and we are modifying example, I am fine with change. But I would rather remove 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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-60259][SQL] Treat Oracle broken synonyms (ORA-00980) as not selectable [spark]

Posted by "alekjarmov (via GitHub)" <gi...@apache.org>.
alekjarmov commented on code in PR #59505:
URL: https://github.com/apache/spark/pull/59505#discussion_r4285808071


##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala:
##########
@@ -819,9 +819,9 @@ abstract class JdbcDialect extends Serializable with Logging {
 
   /**
    * Returns true if the given exception indicates the object exists but cannot be read as a
-   * table or view (e.g. a synonym that resolves to a procedure, or an invalid view), as opposed
-   * to not existing at all (see `isObjectNotFoundException`). Dialects override this to recognize
-   * their own error codes; the default is false.
+   * table or view (e.g. a synonym that resolves to a procedure or a missing object, or an

Review Comment:
   Removed. The public Javadoc example is unchanged; OracleDialect still classifies ORA-00980 next to ORA-04044 / ORA-04063.



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-60259][SQL] Treat Oracle broken synonyms (ORA-00980) as not selectable [spark]

Posted by "urosstan-db (via GitHub)" <gi...@apache.org>.
urosstan-db commented on code in PR #59505:
URL: https://github.com/apache/spark/pull/59505#discussion_r4285833766


##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala:
##########
@@ -819,9 +819,9 @@ abstract class JdbcDialect extends Serializable with Logging {
 
   /**
    * Returns true if the given exception indicates the object exists but cannot be read as a
-   * table or view (e.g. a synonym that resolves to a procedure, or an invalid view), as opposed
-   * to not existing at all (see `isObjectNotFoundException`). Dialects override this to recognize
-   * their own error codes; the default is false.
+   * table or view (e.g. a synonym that resolves to a procedure or a missing object, or an

Review Comment:
   Thanks a lot



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-60259][SQL] Treat Oracle broken synonyms (ORA-00980) as not selectable [spark]

Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan closed pull request #59505: [SPARK-60259][SQL] Treat Oracle broken synonyms (ORA-00980) as not selectable
URL: https://github.com/apache/spark/pull/59505


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org