[SPARK-28495][SQL][FOLLOW-UP] Disallow conversions between timestamp and long in ASNI mode#25615
Closed
gengliangwang wants to merge 1 commit into
Closed
[SPARK-28495][SQL][FOLLOW-UP] Disallow conversions between timestamp and long in ASNI mode#25615gengliangwang wants to merge 1 commit into
gengliangwang wants to merge 1 commit into
Conversation
Member
Author
|
@cloud-fan @maropu Please help review this one. |
Member
|
The change looks reasonable to me. Just in case, I checked the pgSQL behaivour again; |
maropu
reviewed
Aug 29, 2019
| "Should not allow timestamp to long") { err => | ||
| assert(err.contains("Cannot safely cast 'timestampToLong': TimestampType to LongType")) | ||
| } | ||
| } |
Member
There was a problem hiding this comment.
btw, we don't have any existing test for these cast case, right? (I just a bit worried about forgetting to add tests for the other cast cases in the ANSI mode...
Member
Author
There was a problem hiding this comment.
I think so. Let's wait for the test result.
maropu
approved these changes
Aug 29, 2019
cloud-fan
approved these changes
Aug 29, 2019
|
Test build #109899 has finished for PR 25615 at commit
|
Member
Author
|
retest this please. |
|
Test build #109901 has finished for PR 25615 at commit
|
Contributor
|
thanks, merging to master! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Disallow conversions between
timestamptype andlongtype in table insertion with ANSI store assignment policy.Why are the changes needed?
In the PR #25581, timestamp type is allowed to be converted to long type, since timestamp type is represented by long type internally, and both legacy mode and strict mode allows the conversion.
After reconsideration, I think we should disallow it. As per ANSI SQL section "4.4.2 Characteristics of numbers":
In PostgreSQL, the conversion between timestamp and long is also disallowed.
Does this PR introduce any user-facing change?
Conversion between timestamp and long is disallowed in table insertion with ANSI store assignment policy.
How was this patch tested?
Unit test