-
Notifications
You must be signed in to change notification settings - Fork 28.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-10177] [SQL] fix reading Timestamp in parquet from Hive #8400
Changes from 5 commits
808ae3b
809e164
3491f2f
e96f92f
9b1b9ce
05437e1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,13 +49,18 @@ class DateTimeUtilsSuite extends SparkFunSuite { | |
test("us and julian day") { | ||
val (d, ns) = toJulianDay(0) | ||
assert(d === JULIAN_DAY_OF_EPOCH) | ||
assert(ns === SECONDS_PER_DAY / 2 * NANOS_PER_SECOND) | ||
assert(ns === 0) | ||
assert(fromJulianDay(d, ns) == 0L) | ||
|
||
val t = new Timestamp(61394778610000L) // (2015, 6, 11, 10, 10, 10, 100) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems that this timestamp value is wrong: scala> java.util.TimeZone.setDefault(java.util.TimeZone.getTimeZone("PST"))
scala> new java.sql.Timestamp(61394778610000L)
res3: java.sql.Timestamp = 3915-07-11 10:10:10.0 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The extra 1900 years and 1 month seems to be related to this Javadoc of one of /**
* Constructs a <code>Timestamp</code> object initialized
* with the given values.
*
* @param year the year minus 1900
* @param month 0 to 11
* @param date 1 to 31
* @param hour 0 to 23
* @param minute 0 to 59
* @param second 0 to 59
* @param nano 0 to 999,999,999
* @deprecated instead use the constructor <code>Timestamp(long millis)</code>
* @exception IllegalArgumentException if the nano argument is out of bounds
*/ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably replace it with |
||
val (d1, ns1) = toJulianDay(fromJavaTimestamp(t)) | ||
val t2 = toJavaTimestamp(fromJulianDay(d1, ns1)) | ||
assert(t.equals(t2)) | ||
val t1 = toJavaTimestamp(fromJulianDay(d1, ns1)) | ||
assert(t.equals(t1)) | ||
|
||
val t2 = new Timestamp(61394814610000L) // (2015, 6, 11, 20, 10, 10, 100) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. |
||
val (d2, ns2) = toJulianDay(fromJavaTimestamp(t2)) | ||
val t22 = toJavaTimestamp(fromJulianDay(d2, ns2)) | ||
assert(t2.equals(t22)) | ||
} | ||
|
||
test("SPARK-6785: java date conversion before and after epoch") { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: removing the trailing
//
?