Skip to content

Commit dbb2a64

Browse files
Fixed issue with unset property
1 parent 4649766 commit dbb2a64

File tree

1 file changed

+4
-2
lines changed
  • sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc

1 file changed

+4
-2
lines changed

sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JDBCRDD.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ private[sql] object JDBCRDD extends Logging {
224224
quotedColumns,
225225
filters,
226226
parts,
227+
url,
227228
properties)
228229
}
229230
}
@@ -241,6 +242,7 @@ private[sql] class JDBCRDD(
241242
columns: Array[String],
242243
filters: Array[Filter],
243244
partitions: Array[Partition],
245+
url: String,
244246
properties: Properties)
245247
extends RDD[InternalRow](sc, Nil) {
246248

@@ -361,7 +363,7 @@ private[sql] class JDBCRDD(
361363
context.addTaskCompletionListener{ context => close() }
362364
val part = thePart.asInstanceOf[JDBCPartition]
363365
val conn = getConnection()
364-
val dialect = JdbcDialects.get(properties.getProperty("url"))
366+
val dialect = JdbcDialects.get(url)
365367
import scala.collection.JavaConverters._
366368
dialect.beforeFetch(conn, properties.asScala.toMap)
367369

@@ -496,7 +498,7 @@ private[sql] class JDBCRDD(
496498
try {
497499
conn.commit()
498500
} catch {
499-
case e: Exception => logWarning("Exception committing transaction", e)
501+
case e: Throwable => logWarning("Exception committing transaction", e)
500502
}
501503
}
502504
conn.close()

0 commit comments

Comments
 (0)