-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-15321] Fix bug where Array[Timestamp] cannot be encoded/decoded correctly #13108
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
|
(I think it might needs a JIRA because it seems changing existing behaviour) |
|
@HyukjinKwon I think the original author might have just forgotten to add the TimestampType to the match.. |
|
The bug is quite easy to reproduce. In
... you will see that (without this fix) it fails with the following output: |
|
@smungee Can you please add tests for this ? |
|
@techaddict Added a test |
|
@smungee sorry to have this gone stale. Do you mind bringing it up to date? This seems useful to fix. |
387e6c9 to
b2f2914
Compare
|
@rxin The code in question seems to have been removed in this commit by @cloud-fan With the latest SNAPSHOT version, I no longer see the bug. I've updated this PR to include just my additional test-case, just to make sure it doesn't happen again. I'd recommend adding this test-case in. |
|
Test build #2999 has finished for PR 13108 at commit
|
|
LGTM, merging to master and 2.0, thanks! |
…d correctly
## What changes were proposed in this pull request?
Fix `MapObjects.itemAccessorMethod` to handle `TimestampType`. Without this fix, `Array[Timestamp]` cannot be properly encoded or decoded. To reproduce this, in `ExpressionEncoderSuite`, if you add the following test case:
`encodeDecodeTest(Array(Timestamp.valueOf("2016-01-29 10:00:00")), "array of timestamp")
`
... you will see that (without this fix) it fails with the following output:
```
- encode/decode for array of timestamp: [Ljava.sql.Timestamp;fd9ebde *** FAILED ***
Exception thrown while decoding
Converted: [0,1000000010,800000001,52a7ccdc36800]
Schema: value#61615
root
-- value: array (nullable = true)
|-- element: timestamp (containsNull = true)
Encoder:
class[value[0]: array<timestamp>] (ExpressionEncoderSuite.scala:312)
```
## How was this patch tested?
Existing tests
Author: Sumedh Mungee <[email protected]>
Closes #13108 from smungee/fix-itemAccessorMethod.
(cherry picked from commit d5c47f8)
Signed-off-by: Wenchen Fan <[email protected]>
What changes were proposed in this pull request?
Fix
MapObjects.itemAccessorMethodto handleTimestampType. Without this fix,Array[Timestamp]cannot be properly encoded or decoded. To reproduce this, inExpressionEncoderSuite, if you add the following test case:encodeDecodeTest(Array(Timestamp.valueOf("2016-01-29 10:00:00")), "array of timestamp")... you will see that (without this fix) it fails with the following output:
How was this patch tested?
Existing tests