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 @@ -101,7 +101,7 @@ private case class DB2Dialect() extends JdbcDialect with SQLConfHelper with NoLe
}

override def getJDBCType(dt: DataType): Option[JdbcType] = dt match {
case _: StringType => Option(JdbcType("CLOB", java.sql.Types.CLOB))
case StringType => Option(JdbcType("CLOB", java.sql.Types.CLOB))
case BooleanType if conf.legacyDB2BooleanMappingEnabled =>
Option(JdbcType("CHAR(1)", java.sql.Types.CHAR))
case BooleanType => Option(JdbcType("BOOLEAN", java.sql.Types.BOOLEAN))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private case class DatabricksDialect() extends JdbcDialect with NoLegacyJDBCErro
override def getJDBCType(dt: DataType): Option[JdbcType] = dt match {
case BooleanType => Some(JdbcType("BOOLEAN", java.sql.Types.BOOLEAN))
case DoubleType => Some(JdbcType("DOUBLE", java.sql.Types.DOUBLE))
case _: StringType => Some(JdbcType("STRING", java.sql.Types.VARCHAR))
case StringType => Some(JdbcType("STRING", java.sql.Types.VARCHAR))
case BinaryType => Some(JdbcType("BINARY", java.sql.Types.BINARY))
case _ => None
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private case class DerbyDialect() extends JdbcDialect with NoLegacyJDBCError {
}

override def getJDBCType(dt: DataType): Option[JdbcType] = dt match {
case _: StringType => Option(JdbcType("CLOB", java.sql.Types.CLOB))
case StringType => Option(JdbcType("CLOB", java.sql.Types.CLOB))
case ByteType => Option(JdbcType("SMALLINT", java.sql.Types.SMALLINT))
case ShortType => Option(JdbcType("SMALLINT", java.sql.Types.SMALLINT))
case BooleanType => Option(JdbcType("BOOLEAN", java.sql.Types.BOOLEAN))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private[sql] case class H2Dialect() extends JdbcDialect with NoLegacyJDBCError {
}

override def getJDBCType(dt: DataType): Option[JdbcType] = dt match {
case _: StringType => Option(JdbcType("CLOB", Types.CLOB))
case StringType => Option(JdbcType("CLOB", Types.CLOB))
case BooleanType => Some(JdbcType("BOOLEAN", Types.BOOLEAN))
case ShortType | ByteType => Some(JdbcType("SMALLINT", Types.SMALLINT))
case t: DecimalType => Some(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ private case class MsSqlServerDialect() extends JdbcDialect with NoLegacyJDBCErr
override def getJDBCType(dt: DataType): Option[JdbcType] = dt match {
case TimestampType => Some(JdbcType("DATETIME", java.sql.Types.TIMESTAMP))
case TimestampNTZType => Some(JdbcType("DATETIME", java.sql.Types.TIMESTAMP))
case _: StringType => Some(JdbcType("NVARCHAR(MAX)", java.sql.Types.NVARCHAR))
case StringType => Some(JdbcType("NVARCHAR(MAX)", java.sql.Types.NVARCHAR))
case BooleanType => Some(JdbcType("BIT", java.sql.Types.BIT))
case BinaryType => Some(JdbcType("VARBINARY(MAX)", java.sql.Types.VARBINARY))
case ShortType if !SQLConf.get.legacyMsSqlServerNumericMappingEnabled =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ private case class MySQLDialect() extends JdbcDialect with SQLConfHelper with No
// See SPARK-35446: MySQL treats REAL as a synonym to DOUBLE by default
// We override getJDBCType so that FloatType is mapped to FLOAT instead
case FloatType => Option(JdbcType("FLOAT", java.sql.Types.FLOAT))
case _: StringType => Option(JdbcType("LONGTEXT", java.sql.Types.LONGVARCHAR))
case StringType => Option(JdbcType("LONGTEXT", java.sql.Types.LONGVARCHAR))
case ByteType => Option(JdbcType("TINYINT", java.sql.Types.TINYINT))
case ShortType => Option(JdbcType("SMALLINT", java.sql.Types.SMALLINT))
// scalastyle:off line.size.limit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ private case class OracleDialect() extends JdbcDialect with SQLConfHelper with N
case DoubleType => Some(JdbcType("NUMBER(19, 4)", java.sql.Types.DOUBLE))
case ByteType => Some(JdbcType("NUMBER(3)", java.sql.Types.SMALLINT))
case ShortType => Some(JdbcType("NUMBER(5)", java.sql.Types.SMALLINT))
case _: StringType => Some(JdbcType("VARCHAR2(255)", java.sql.Types.VARCHAR))
case StringType => Some(JdbcType("VARCHAR2(255)", java.sql.Types.VARCHAR))
case VarcharType(n) => Some(JdbcType(s"VARCHAR2($n)", java.sql.Types.VARCHAR))
case TimestampType if !conf.legacyOracleTimestampMappingEnabled =>
Some(JdbcType("TIMESTAMP WITH LOCAL TIME ZONE", TIMESTAMP_LTZ))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ private case class PostgresDialect()
}

override def getJDBCType(dt: DataType): Option[JdbcType] = dt match {
case _: StringType => Some(JdbcType("TEXT", Types.VARCHAR))
case StringType => Some(JdbcType("TEXT", Types.VARCHAR))
case BinaryType => Some(JdbcType("BYTEA", Types.BINARY))
case BooleanType => Some(JdbcType("BOOLEAN", Types.BOOLEAN))
case FloatType => Some(JdbcType("FLOAT4", Types.FLOAT))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private case class TeradataDialect() extends JdbcDialect with NoLegacyJDBCError
supportedFunctions.contains(funcName)

override def getJDBCType(dt: DataType): Option[JdbcType] = dt match {
case _: StringType => Some(JdbcType("VARCHAR(255)", java.sql.Types.VARCHAR))
case StringType => Some(JdbcType("VARCHAR(255)", java.sql.Types.VARCHAR))
case BooleanType => Option(JdbcType("CHAR(1)", java.sql.Types.CHAR))
case ByteType => Option(JdbcType("BYTEINT", java.sql.Types.TINYINT))
case _ => None
Expand Down