Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
maropu committed Jun 27, 2018
1 parent 50e7b11 commit 1cfc7b0
Showing 1 changed file with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ object DataSourceUtils {
case BooleanType | ByteType | ShortType | IntegerType | LongType | FloatType | DoubleType |
StringType | BinaryType | DateType | TimestampType | _: DecimalType =>

case _: CalendarIntervalType | _: StructType | _: ArrayType | _: MapType
// All the unsupported types for CSV
case _: NullType | _: CalendarIntervalType | _: StructType | _: ArrayType | _: MapType
if format.isInstanceOf[CSVFileFormat] =>
throwUnsupportedException(dataType)

Expand All @@ -73,23 +74,27 @@ object DataSourceUtils {
verifyType(keyType)
verifyType(valueType)

case udt: UserDefinedType[_] => verifyType(udt.sqlType)

// Interval type not supported in all the write path
case _: CalendarIntervalType if !isReadPath =>
throwUnsupportedException(dataType)

// JSON and ORC don't support an Interval type, but we pass it in read pass
// for back-compatibility.
case _: CalendarIntervalType if isReadPath &&
(format.isInstanceOf[JsonFileFormat] | format.isInstanceOf[OrcFileFormat]) =>
case _: CalendarIntervalType if format.isInstanceOf[JsonFileFormat] ||
format.isInstanceOf[OrcFileFormat] =>

case udt: UserDefinedType[_] => verifyType(udt.sqlType)
// Interval type not supported in the other read path
case _: CalendarIntervalType =>
throwUnsupportedException(dataType)

// For JSON backward-compatibility
case NullType if format.isInstanceOf[JsonFileFormat] ||
// For JSON & ORC backward-compatibility
case _: NullType if format.isInstanceOf[JsonFileFormat] ||
(isReadPath && format.isInstanceOf[OrcFileFormat]) =>

// Actually we won't pass in unsupported data types below, this is a safety check
case _: CalendarIntervalType if format.isInstanceOf[JsonFileFormat] =>
throwUnsupportedException(dataType)

case _: CalendarIntervalType | _: NullType
if format.isInstanceOf[ParquetFileFormat] || format.isInstanceOf[OrcFileFormat] =>
// Null type not supported in the other path
case _: NullType =>
throwUnsupportedException(dataType)

// We keep this default case for safeguards
Expand Down

0 comments on commit 1cfc7b0

Please sign in to comment.