-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[SPARK-57778][SQL] Handle Oracle JDBC objects that are not selectable as tables #56898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -808,6 +808,9 @@ abstract class JdbcDialect extends Serializable with Logging { | |
| Option(e.getSQLState).exists(_.startsWith("42")) | ||
| } | ||
|
|
||
| @Since("4.3.0") | ||
| def isNotSelectableObjectException(e: SQLException): Boolean = false | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a general opt-in hook (base default /**
* 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.
*/(Left as an illustrative block rather than a one-click suggestion so it doesn't collide with the |
||
|
|
||
| /** | ||
| * Gets a dialect exception, classifies it and wraps it by `AnalysisException`. | ||
| * @param e The dialect specific exception. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,6 +54,13 @@ private case class OracleDialect() extends JdbcDialect with SQLConfHelper with N | |
| e.getMessage.contains("ORA-39165") | ||
| } | ||
|
|
||
| override def isNotSelectableObjectException(e: SQLException): Boolean = { | ||
| // ORA-04044: object is not a table (e.g. a synonym to a procedure/function/package). | ||
| e.getMessage.contains("ORA-04044") || | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Optional, non-blocking: matching on |
||
| // ORA-04063: object is invalid (e.g. a view over a dropped base table). | ||
| e.getMessage.contains("ORA-04063") | ||
| } | ||
|
|
||
| class OracleSQLBuilder extends JDBCSQLBuilder { | ||
|
|
||
| override def visitExtract(extract: Extract): String = { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.