-
Notifications
You must be signed in to change notification settings - Fork 28k
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
[SPARK-29675][SQL] Add exception when isolationLevel is Illegal #26334
Changes from 1 commit
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 |
---|---|---|
|
@@ -177,6 +177,10 @@ class JDBCOptions( | |
case "READ_COMMITTED" => Connection.TRANSACTION_READ_COMMITTED | ||
case "REPEATABLE_READ" => Connection.TRANSACTION_REPEATABLE_READ | ||
case "SERIALIZABLE" => Connection.TRANSACTION_SERIALIZABLE | ||
case other => throw new IllegalArgumentException( | ||
s"Invalid value `$other` for parameter `$JDBC_TXN_ISOLATION_LEVEL`. This can be " + | ||
s"`NONE`, `READ_UNCOMMITTED`, `READ_COMMITTED`, `REPEATABLE_READ` or `SERIALIZABLE`." | ||
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. nit: plz drop |
||
) | ||
} | ||
// An option to execute custom SQL before fetching data from the remote DB | ||
val sessionInitStatement = parameters.get(JDBC_SESSION_INIT_STATEMENT) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1649,4 +1649,17 @@ class JDBCSuite extends QueryTest | |
} | ||
} | ||
} | ||
|
||
test("SPARK-29675 Add exception when isolationLevel is Illegal") { | ||
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. Super nit. @ulysses-you . We don't use JIRA ID for the improvement test cases. It's used for bug fixes only. 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. I discussed with @dongjoon-hyun offline. I will send an email to dev mailing list to discuss and officially document this test prefix for JIRA ID, after having some more offline discussions with some other PMCs. 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. Looks nice, thx, PMC guys! |
||
val e = intercept[IllegalArgumentException] { | ||
spark.read.format("jdbc") | ||
.option("Url", urlWithUserAndPass) | ||
.option("dbTable", "test.people") | ||
.option("isolationLevel", "test") | ||
.load() | ||
}.getMessage | ||
assert(e.contains( | ||
"Invalid value `test` for parameter `isolationLevel`. This can be " + | ||
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. You can probably just check for the first sentence rather than depend on this exact entire string. But it doesn't matter much. |
||
"`NONE`, `READ_UNCOMMITTED`, `READ_COMMITTED`, `REPEATABLE_READ` or `SERIALIZABLE`.")) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: back-ticks aren't meaningful here right?