createConnectionFactory(options: JDBCOptions): () => ConnectionJdbcUtils Helper Object
JdbcUtils is a Scala object with methods to support JDBCRDD, JDBCRelation and JdbcRelationProvider.
| Name | Description | 
|---|---|
| Used when: 
 | |
| Replaces data types in a table schema Used exclusively when  | |
| Used when  | |
| Used when  | |
| Used when…FIXME | |
| Used when  | |
| Used when  | |
| Used when…FIXME | 
 createConnectionFactory Method
createConnectionFactory…FIXME
| Note | 
 
 | 
 getCommonJDBCType Method
getCommonJDBCType(dt: DataType): Option[JdbcType]getCommonJDBCType…FIXME
| Note | getCommonJDBCTypeis used when…FIXME | 
 getCatalystType Internal Method
getCatalystType(
  sqlType: Int,
  precision: Int,
  scale: Int,
  signed: Boolean): DataTypegetCatalystType…FIXME
| Note | getCatalystTypeis used when…FIXME | 
 getSchemaOption Method
getSchemaOption(conn: Connection, options: JDBCOptions): Option[StructType]getSchemaOption…FIXME
| Note | getSchemaOptionis used when…FIXME | 
 getSchema Method
getSchema(
  resultSet: ResultSet,
  dialect: JdbcDialect,
  alwaysNullable: Boolean = false): StructTypegetSchema…FIXME
| Note | getSchemais used when…FIXME | 
 resultSetToRows Method
resultSetToRows(resultSet: ResultSet, schema: StructType): Iterator[Row]resultSetToRows…FIXME
| Note | resultSetToRowsis used when…FIXME | 
 resultSetToSparkInternalRows Method
resultSetToSparkInternalRows(
  resultSet: ResultSet,
  schema: StructType,
  inputMetrics: InputMetrics): Iterator[InternalRow]resultSetToSparkInternalRows…FIXME
| Note | resultSetToSparkInternalRowsis used when…FIXME | 
 schemaString Method
schemaString(
  df: DataFrame,
  url: String,
  createTableColumnTypes: Option[String] = None): StringschemaString…FIXME
| Note | schemaStringis used exclusively whenJdbcUtilsis requested to create a table. | 
 parseUserSpecifiedCreateTableColumnTypes Internal Method
parseUserSpecifiedCreateTableColumnTypes(
  df: DataFrame,
  createTableColumnTypes: String): Map[String, String]parseUserSpecifiedCreateTableColumnTypes…FIXME
| Note | parseUserSpecifiedCreateTableColumnTypesis used exclusively whenJdbcUtilsis requested to schemaString. | 
 saveTable Method
saveTable(
  df: DataFrame,
  tableSchema: Option[StructType],
  isCaseSensitive: Boolean,
  options: JDBCOptions): UnitsaveTable takes the url, table, batchSize, isolationLevel options and createConnectionFactory.
saveTable getInsertStatement.
saveTable takes the numPartitions option and applies coalesce operator to the input DataFrame if the number of partitions of its RDD is less than the numPartitions option.
In the end, saveTable requests the possibly-repartitioned DataFrame for its RDD (it may have changed after the coalesce operator) and executes savePartition for every partition (using RDD.foreachPartition).
| Note | saveTableis used exclusively whenJdbcRelationProvideris requested to write the rows of a structured query (a DataFrame) to a table. | 
 Replacing Data Types In Table Schema — getCustomSchema Method
getCustomSchema(
  tableSchema: StructType,
  customSchema: String,
  nameEquality: Resolver): StructTypegetCustomSchema replaces the data type of the fields in the input tableSchema schema that are included in the input customSchema (if defined).
Internally, getCustomSchema branches off per the input customSchema.
If the input customSchema is undefined or empty, getCustomSchema simply returns the input tableSchema unchanged.
Otherwise, if the input customSchema is not empty, getCustomSchema requests CatalystSqlParser to parse it (i.e. create a new StructType for the given customSchema canonical schema representation).
getCustomSchema then uses SchemaUtils to checkColumnNameDuplication (in the column names of the user-defined customSchema schema with the input nameEquality).
In the end, getCustomSchema replaces the data type of the fields in the input tableSchema that are included in the input userSchema.
| Note | getCustomSchemais used exclusively whenJDBCRelationis created (and customSchema JDBC option was defined). | 
 dropTable Method
dropTable(conn: Connection, table: String): UnitdropTable…FIXME
| Note | dropTableis used when…FIXME | 
 Creating Table Using JDBC — createTable Method
createTable(
  conn: Connection,
  df: DataFrame,
  options: JDBCOptions): UnitcreateTable builds the table schema (given the input DataFrame with the url and createTableColumnTypes options).
createTable uses the table and createTableOptions options.
In the end, createTable concatenates all the above texts into a CREATE TABLE [table] ([strSchema]) [createTableOptions] SQL DDL statement followed by executing it (using the input JDBC Connection).
| Note | createTableis used exclusively whenJdbcRelationProvideris requested to write the rows of a structured query (a DataFrame) to a table. | 
 getInsertStatement Method
getInsertStatement(
  table: String,
  rddSchema: StructType,
  tableSchema: Option[StructType],
  isCaseSensitive: Boolean,
  dialect: JdbcDialect): StringgetInsertStatement…FIXME
| Note | getInsertStatementis used when…FIXME | 
 getJdbcType Internal Method
getJdbcType(dt: DataType, dialect: JdbcDialect): JdbcTypegetJdbcType…FIXME
| Note | getJdbcTypeis used when…FIXME | 
 tableExists Method
tableExists(conn: Connection, options: JDBCOptions): BooleantableExists…FIXME
| Note | tableExistsis used exclusively whenJdbcRelationProvideris requested to write the rows of a structured query (a DataFrame) to a table. | 
 truncateTable Method
truncateTable(conn: Connection, options: JDBCOptions): UnittruncateTable…FIXME
| Note | truncateTableis used exclusively whenJdbcRelationProvideris requested to write the rows of a structured query (a DataFrame) to a table. | 
 Saving Rows (Per Partition) to Table — savePartition Method
savePartition(
  getConnection: () => Connection,
  table: String,
  iterator: Iterator[Row],
  rddSchema: StructType,
  insertStmt: String,
  batchSize: Int,
  dialect: JdbcDialect,
  isolationLevel: Int): Iterator[Byte]savePartition creates a JDBC Connection using the input getConnection function.
savePartition tries to set the input isolationLevel if it is different than TRANSACTION_NONE and the database supports transactions.
savePartition then writes rows (in the input Iterator[Row]) using batches that are submitted after batchSize rows where added.
| Note | savePartitionis used exclusively whenJdbcUtilsis requested to saveTable. |