Skip to content
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Import order
  • Loading branch information
Ilya Ganelin committed Jan 24, 2017
commit 56545ed88f665ed57a50a8c5d114c6ae8130eab3
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ package org.apache.spark.sql.execution.datasources.jdbc
import java.sql.{Connection, Driver, DriverManager, PreparedStatement, ResultSet, ResultSetMetaData, SQLException, Statement}
import java.util.Properties

import scala.collection.JavaConverters._
import scala.util.Try
import scala.util.control.NonFatal

import org.apache.spark.TaskContext
import org.apache.spark.executor.InputMetrics
import org.apache.spark.internal.Logging
Expand All @@ -34,10 +38,6 @@ import org.apache.spark.sql.types._
import org.apache.spark.unsafe.types.UTF8String
import org.apache.spark.util.NextIterator

import scala.collection.JavaConverters._
import scala.util.Try
import scala.util.control.NonFatal

/**
* Util functions for JDBC tables.
*/
Expand Down Expand Up @@ -764,7 +764,6 @@ object JdbcUtils extends Logging {
statements: DataFrame,
batchSize: Int = DEFAULT_BATCH_SIZE,
maxConnections: Int = DEFAULT_MAX_CONNECTIONS): Unit = {
import statements.sparkSession.implicits._
// To avoid overloading database coalesce to a set number of partitions if necessary
val coalesced = if (statements.rdd.getNumPartitions > maxConnections) {
statements.coalesce(maxConnections)
Expand Down