-
Notifications
You must be signed in to change notification settings - Fork 483
Add YEAR_MONTH_INTERVAL and DURATION types #496
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
base: master
Are you sure you want to change the base?
Changes from 11 commits
0e5b190
81aa637
270d7ef
f3a6863
d4068da
cee153d
c57e370
2196689
85bd7d2
8b76121
fcb6b8b
f72554f
eeedd5b
fa770f8
7be0555
37df43f
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -521,7 +521,12 @@ as shown below. | |||||
| </tr> | ||||||
| </table> | ||||||
|
|
||||||
| ### INTERVAL | ||||||
| ### Interval types | ||||||
|
|
||||||
| #### INTERVAL | ||||||
|
|
||||||
| `INTERVAL` is *deprecated*. Please use `YEAR_MONTH_INTERVAL` and `DURATION` | ||||||
| as a more precise representation per [ANSI SQL Standard](https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/Data-Types.html#GUID-7690645A-0EE3-46CA-90DE-C96DF5A01F8F). | ||||||
|
|
||||||
| `INTERVAL` is used for an interval of time. It must annotate a | ||||||
| `fixed_len_byte_array` of length 12. This array stores three little-endian | ||||||
|
|
@@ -539,6 +544,27 @@ The sort order used for `INTERVAL` is undefined. When writing data, no min/max | |||||
| statistics should be saved for this type and if such non-compliant statistics | ||||||
| are found during reading, they must be ignored. | ||||||
|
|
||||||
| #### YEAR_MONTH_INTERVAL | ||||||
|
|
||||||
| `YEAR_MONTH_INTERVAL` is used to represent a year-month time interval, such as | ||||||
| `4 years and 6 months`. It must annotate an `int32` that stores the total number | ||||||
| of months as a signed integer, which represents the interval and can be negative. | ||||||
|
gh-yzou marked this conversation as resolved.
|
||||||
| The time duration is independent of any timezone. | ||||||
|
Contributor
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. I think we can delete this line?
Author
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. sg! deleted |
||||||
|
|
||||||
| #### DURATION | ||||||
|
|
||||||
| `DURATION` is used to represent a span of time, such as `5 days`. It must | ||||||
| annotate an `int64` value that stores the total number of time units for the | ||||||
| duration. The value is a signed integer and can be negative to indicate backward duration. | ||||||
| The duration is purely a measure of time and is independent of any time zone. | ||||||
|
|
||||||
| The `DURATION` type takes `unit` as a parameter, and the value must be one of | ||||||
| `MILLIS`, `MICROS` or `NANOS`. | ||||||
|
Member
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.
Suggested change
|
||||||
|
|
||||||
| Duration of 1 day is defined exactly of 24 hours, regardless of the specific number of | ||||||
|
Contributor
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. I'm not sure this makes sense without mentioning, that Durations support the ANSI SQL definition of DAY_TIME. we might want to rephrase a little bit.
Contributor
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.
Suggested change
Author
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. make sense. mentioned ANSI SQL standard in the description |
||||||
| seconds in a calendar day. For example, a 1-day duration is always equal to | ||||||
| 86,400,000,000 nanoseconds. | ||||||
|
|
||||||
| ## Embedded Types | ||||||
|
|
||||||
| Embedded types do not have type-specific orderings. | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -461,6 +461,30 @@ struct GeographyType { | |||||
| 2: optional EdgeInterpolationAlgorithm algorithm; | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
| * Year-Month Interval logical type annotation | ||||||
| * | ||||||
| * The data is stored as an 4 byte signed integer which represents the number | ||||||
|
Member
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.
Suggested change
|
||||||
| * of months associated with the time interval. The value can be negative to | ||||||
| * indicate a backward duration. | ||||||
|
gh-yzou marked this conversation as resolved.
|
||||||
| * | ||||||
| * Allowed for physical type: INT32 | ||||||
| */ | ||||||
| struct YearMonthIntervalType { | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
| * Day-Time Interval logical type annotation | ||||||
|
Contributor
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.
Suggested change
Author
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. updated |
||||||
| * | ||||||
| * The data is stored as a 8-byte signed integer which represents the number of | ||||||
| * total time units. The value can be negative to indicate a backward duration. | ||||||
| * | ||||||
| * Allowed for physical type: INT64 | ||||||
| */ | ||||||
| struct DurationType { | ||||||
| 1: required TimeUnit unit | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
| * LogicalType annotations to replace ConvertedType. | ||||||
| * | ||||||
|
|
@@ -494,6 +518,10 @@ union LogicalType { | |||||
| 16: VariantType VARIANT // no compatible ConvertedType | ||||||
| 17: GeometryType GEOMETRY // no compatible ConvertedType | ||||||
| 18: GeographyType GEOGRAPHY // no compatible ConvertedType | ||||||
|
|
||||||
| // INTERVAL types | ||||||
|
gh-yzou marked this conversation as resolved.
|
||||||
| 19: YearMonthIntervalType YEAR_MONTH_INTERVAL // no compatible convertedType | ||||||
| 20: DurationType DURATION // no compatible convertedType | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
|
|
@@ -1071,6 +1099,8 @@ union ColumnOrder { | |||||
| * VARIANT - undefined | ||||||
| * GEOMETRY - undefined | ||||||
| * GEOGRAPHY - undefined | ||||||
| * YEAR_MONTH_INTERVAL - signed comparison of the represented value | ||||||
| * DURATION - signed comparison of the represented value | ||||||
| * | ||||||
| * In the absence of logical types, the sort order is determined by the physical type: | ||||||
| * BOOLEAN - false, true | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.