-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-32594][SQL][FOLLOWUP][test-hadoop2.7][test-hive1.2] Override get() and use Julian days in DaysWritable
#29523
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
Conversation
|
Thanks @MaxGekk |
|
@MaxGekk This fix is also for branch-3.0, right? |
@viirya Yes. |
|
Test build #127811 has finished for PR 29523 at commit
|
|
Github Actions was passed. |
|
Thanks @MaxGekk. Merging this to master and branch-3.0. |
…get()` and use Julian days in `DaysWritable` ### What changes were proposed in this pull request? Override `def get: Date` in `DaysWritable` use the `daysToMillis(int d)` from the parent class `DateWritable` instead of `long daysToMillis(int d, boolean doesTimeMatter)`. ### Why are the changes needed? It fixes failures of `HiveSerDeReadWriteSuite` with the profile `hive-1.2`. In that case, the parent class `DateWritable` has different implementation before the commit to Hive apache/hive@da3ed68. In particular, `get()` calls `new Date(daysToMillis(daysSinceEpoch))` instead of overrided `def get(doesTimeMatter: Boolean): Date` in the child class. The `get()` method returns wrong result `1970-01-01` because it uses not updated `daysSinceEpoch`. ### Does this PR introduce _any_ user-facing change? Yes. ### How was this patch tested? By running the test suite `HiveSerDeReadWriteSuite`: ``` $ build/sbt -Phive-1.2 -Phadoop-2.7 "test:testOnly org.apache.spark.sql.hive.execution.HiveSerDeReadWriteSuite" ``` and ``` $ build/sbt -Phive-2.3 -Phadoop-2.7 "test:testOnly org.apache.spark.sql.hive.execution.HiveSerDeReadWriteSuite" ``` Closes #29523 from MaxGekk/insert-date-into-hive-table-1.2. Authored-by: Max Gekk <[email protected]> Signed-off-by: Liang-Chi Hsieh <[email protected]> (cherry picked from commit 1c798f9) Signed-off-by: Liang-Chi Hsieh <[email protected]>
|
Verified locally this fixed the test in branch-3.0 too. |
|
late LGTM. Thanks for the fix, @MaxGekk ! |
|
Thank you, @MaxGekk and all! |
What changes were proposed in this pull request?
Override
def get: DateinDaysWritableuse thedaysToMillis(int d)from the parent classDateWritableinstead oflong daysToMillis(int d, boolean doesTimeMatter).Why are the changes needed?
It fixes failures of
HiveSerDeReadWriteSuitewith the profilehive-1.2. In that case, the parent classDateWritablehas different implementation before the commit to Hive apache/hive@da3ed68. In particular,get()callsnew Date(daysToMillis(daysSinceEpoch))instead of overrideddef get(doesTimeMatter: Boolean): Datein the child class. Theget()method returns wrong result1970-01-01because it uses not updateddaysSinceEpoch.Does this PR introduce any user-facing change?
Yes.
How was this patch tested?
By running the test suite
HiveSerDeReadWriteSuite:and