-
Notifications
You must be signed in to change notification settings - Fork 28.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-36924][SQL] CAST between ANSI intervals and IntegralType
### What changes were proposed in this pull request? Add cast `AnsiIntervalType` to `IntegralType` requirement: 1. `YearMonthIntervalType` just have one unit 2. `DayTimeIntervalType` just have one unit cast rule: 1. The value corresponding to the unit of `YearMonthIntervalType` is the value of the `IntegralType` after conversion. 2. The value corresponding to the unit of `DayTimeIntervalType` is the value of the `IntegralType` after conversion. Add cast `IntegralType` to `AnsiIntervalType` requirement: 1. `YearMonthIntervalType` just have one unit 2. `DayTimeIntervalType` just have one unit cast rule: 1. The value of the IntegralTypeis the value of `YearMonthIntervalType` that with the single unit after conversion. 2. The value of the IntegralTypeis the value of `DayTimeIntervalType` that with the single unit after conversion. ### Why are the changes needed? According to 2011 Standards ![截图](https://user-images.githubusercontent.com/41178002/140504037-b86793f0-2c97-49f7-bcbf-bb6864592aa8.PNG) 7) If TD is an interval and SD is exact numeric, then TD shall contain only a single <primary datetime field>. 8) If TD is exact numeric and SD is an interval, then SD shall contain only a single <primary datetime field>. ### Does this PR introduce _any_ user-facing change? Yes, user can use cast function between YearMonthIntervalType to NumericType ### How was this patch tested? add ut testcase Closes #34494 from Peng-Lei/SPARK-36924. Authored-by: PengLei <peng.8lei@gmail.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com>
- Loading branch information
Showing
3 changed files
with
496 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Oops, something went wrong.