Skip to content
Closed
Show file tree
Hide file tree
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
address comments
  • Loading branch information
cloud-fan committed Apr 23, 2021
commit c8dbc1a9fe845632f7143d9c50ec5f154182210b
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ object CatalystTypeConverters {
case l: LocalDate => DateTimeUtils.localDateToDays(l)
case other => throw new IllegalArgumentException(
s"The value (${other.toString}) of the type (${other.getClass.getCanonicalName}) "
+ s"cannot be converted to the date type")
+ s"cannot be converted to the ${DateType.sql} type")
}
override def toScala(catalystValue: Any): Date =
if (catalystValue == null) null else DateTimeUtils.toJavaDate(catalystValue.asInstanceOf[Int])
Expand All @@ -335,7 +335,7 @@ object CatalystTypeConverters {
case i: Instant => DateTimeUtils.instantToMicros(i)
case other => throw new IllegalArgumentException(
s"The value (${other.toString}) of the type (${other.getClass.getCanonicalName}) "
+ s"cannot be converted to the timestamp type")
+ s"cannot be converted to the ${TimestampType.sql} type")
}
override def toScala(catalystValue: Any): Timestamp =
if (catalystValue == null) null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ class CatalystTypeConvertersSuite extends SparkFunSuite with SQLHelper {
val i = Instant.ofEpochSecond(seconds)
val result1 = converter(i)

val t = new java.sql.Timestamp(seconds * 1000)
val t = new java.sql.Timestamp(seconds * DateTimeConstants.MILLIS_PER_SECOND)
val result2 = converter(t)

val expected = seconds * DateTimeConstants.MICROS_PER_SECOND
Expand Down