Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,7 @@ class JDBCOptions(
""".stripMargin
)

val fetchSize = {
val size = parameters.getOrElse(JDBC_BATCH_FETCH_SIZE, "0").toInt
require(size >= 0,
s"Invalid value `${size.toString}` for parameter " +
s"`$JDBC_BATCH_FETCH_SIZE`. The minimum value is 0. When the value is 0, " +
"the JDBC driver ignores the value and does the estimates.")
size
}
val fetchSize = parameters.getOrElse(JDBC_BATCH_FETCH_SIZE, "0").toInt

// ------------------------------------------------------------
// Optional parameters only for writing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,15 +450,6 @@ class JDBCSuite extends QueryTest
urlWithUserAndPass, "TEST.PEOPLE", new Properties()).collect().length === 3)
}

test("Basic API with illegal fetchsize") {
val properties = new Properties()
properties.setProperty(JDBCOptions.JDBC_BATCH_FETCH_SIZE, "-1")
val e = intercept[IllegalArgumentException] {
spark.read.jdbc(urlWithUserAndPass, "TEST.PEOPLE", properties).collect()
}.getMessage
assert(e.contains("Invalid value `-1` for parameter `fetchsize`"))
}

test("Missing partition columns") {
withView("tempPeople") {
val e = intercept[IllegalArgumentException] {
Expand Down