Skip to content

Commit

Permalink
[SPARK-11037][SQL] using Option instead of Some in JdbcDialects
Browse files Browse the repository at this point in the history
Using Option instead of Some in getCatalystType method.

Author: Pravin Gadakh <prgadakh@in.ibm.com>

Closes #9195 from pravingadakh/master.
  • Loading branch information
Pravin Gadakh authored and rxin committed Oct 21, 2015
1 parent 5cdea7d commit 8e82e59
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,15 +198,15 @@ case object PostgresDialect extends JdbcDialect {
override def getCatalystType(
sqlType: Int, typeName: String, size: Int, md: MetadataBuilder): Option[DataType] = {
if (sqlType == Types.BIT && typeName.equals("bit") && size != 1) {
Some(BinaryType)
Option(BinaryType)
} else if (sqlType == Types.OTHER && typeName.equals("cidr")) {
Some(StringType)
Option(StringType)
} else if (sqlType == Types.OTHER && typeName.equals("inet")) {
Some(StringType)
Option(StringType)
} else if (sqlType == Types.OTHER && typeName.equals("json")) {
Some(StringType)
Option(StringType)
} else if (sqlType == Types.OTHER && typeName.equals("jsonb")) {
Some(StringType)
Option(StringType)
} else None
}

Expand Down Expand Up @@ -236,9 +236,9 @@ case object MySQLDialect extends JdbcDialect {
// This could instead be a BinaryType if we'd rather return bit-vectors of up to 64 bits as
// byte arrays instead of longs.
md.putLong("binarylong", 1)
Some(LongType)
Option(LongType)
} else if (sqlType == Types.BIT && typeName.equals("TINYINT")) {
Some(BooleanType)
Option(BooleanType)
} else None
}

Expand Down Expand Up @@ -279,7 +279,7 @@ case object MsSqlServerDialect extends JdbcDialect {
sqlType: Int, typeName: String, size: Int, md: MetadataBuilder): Option[DataType] = {
if (typeName.contains("datetimeoffset")) {
// String is recommend by Microsoft SQL Server for datetimeoffset types in non-MS clients
Some(StringType)
Option(StringType)
} else None
}

Expand Down

0 comments on commit 8e82e59

Please sign in to comment.