Skip to content

Commit 0eecb71

Browse files
committed
feat!: remove deprecated time, timestamp and timestamp_tz types
BREAKING CHANGE Signed-off-by: Niels Pardon <par@zurich.ibm.com>
1 parent 25d87ef commit 0eecb71

33 files changed

Lines changed: 2802 additions & 4042 deletions

extensions/functions_datetime.yaml

Lines changed: 40 additions & 304 deletions
Large diffs are not rendered by default.

grammar/FuncTestCaseParser.g4

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ argument
5555
| stringArg
5656
| decimalArg
5757
| dateArg
58-
| timeArg
59-
| timestampArg
60-
| timestampTzArg
6158
| intervalYearArg
6259
| intervalDayArg
6360
| intervalCompoundArg
@@ -160,18 +157,6 @@ dateArg
160157
: DateLiteral DoubleColon dateType
161158
;
162159

163-
timeArg
164-
: TimeLiteral DoubleColon timeType
165-
;
166-
167-
timestampArg
168-
: TimestampLiteral DoubleColon timestampType
169-
;
170-
171-
timestampTzArg
172-
: TimestampTzLiteral DoubleColon timestampTZType
173-
;
174-
175160
intervalYearArg
176161
: IntervalYearLiteral DoubleColon intervalYearType
177162
;
@@ -249,10 +234,7 @@ scalarType
249234
| floatType #float
250235
| stringType #string
251236
| binaryType #binary
252-
| timestampType #timestamp
253-
| timestampTZType #timestampTz
254237
| dateType #date
255-
| timeType #time
256238
| intervalYearType #intervalYear
257239
| UUID isnull=QMark? #uuid
258240
| UserDefined Identifier isnull=QMark? #userDefined
@@ -282,18 +264,6 @@ dateType
282264
: Date isnull=QMark?
283265
;
284266

285-
timeType
286-
: Time isnull=QMark?
287-
;
288-
289-
timestampType
290-
: (Ts | Timestamp) isnull=QMark?
291-
;
292-
293-
timestampTZType
294-
: (TsTZ | Timestamp_TZ) isnull=QMark?
295-
;
296-
297267
intervalYearType
298268
: (IYear | Interval_Year) isnull=QMark?
299269
;

grammar/SubstraitLexer.g4

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@ FP32 : 'FP32';
2727
FP64 : 'FP64';
2828
String : 'STRING';
2929
Binary : 'BINARY';
30-
Timestamp: 'TIMESTAMP';
31-
Timestamp_TZ: 'TIMESTAMP_TZ';
3230
Date : 'DATE';
33-
Time : 'TIME';
3431
Interval_Year: 'INTERVAL_YEAR';
3532
Interval_Day: 'INTERVAL_DAY';
3633
Interval_Compound: 'INTERVAL_COMPOUND';
@@ -52,8 +49,6 @@ UserDefined: 'U!';
5249
Bool: 'BOOL';
5350
Str: 'STR';
5451
VBin: 'VBIN';
55-
Ts: 'TS';
56-
TsTZ: 'TSTZ';
5752
IYear: 'IYEAR';
5853
IDay: 'IDAY';
5954
ICompound: 'ICOMPOUND';

grammar/SubstraitType.g4

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ scalarType
2020
| FP64 #fp64
2121
| String #string
2222
| Binary #binary
23-
| Timestamp #timestamp
24-
| Timestamp_TZ #timestampTz
2523
| Date #date
26-
| Time #time
2724
| Interval_Year #intervalYear
2825
| UUID #uuid
2926
;

proto/substrait/algebra.proto

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -997,6 +997,8 @@ message Expression {
997997
}
998998

999999
message Literal {
1000+
reserved 14, 17, 27;
1001+
10001002
oneof literal_type {
10011003
bool boolean = 1;
10021004
int32 i8 = 2;
@@ -1007,14 +1009,8 @@ message Expression {
10071009
double fp64 = 11;
10081010
string string = 12;
10091011
bytes binary = 13;
1010-
// Timestamp in units of microseconds since the UNIX epoch.
1011-
// Deprecated in favor of `precision_timestamp`.
1012-
int64 timestamp = 14 [deprecated = true];
10131012
// Date in units of days since the UNIX epoch.
10141013
int32 date = 16;
1015-
// Time in units of microseconds past midnight.
1016-
// Deprecated in favor of `precision_time`.
1017-
int64 time = 17 [deprecated = true];
10181014
IntervalYearToMonth interval_year_to_month = 19;
10191015
IntervalDayToSecond interval_day_to_second = 20;
10201016
IntervalCompound interval_compound = 36;
@@ -1028,9 +1024,6 @@ message Expression {
10281024
PrecisionTimestamp precision_timestamp_tz = 35;
10291025
Struct struct = 25;
10301026
Map map = 26;
1031-
// Timestamp in units of microseconds since the UNIX epoch.
1032-
// Deprecated in favor of `precision_timestamp_tz`
1033-
int64 timestamp_tz = 27 [deprecated = true];
10341027
bytes uuid = 28;
10351028
Type null = 29; // a typed null literal
10361029
List list = 30;

proto/substrait/type.proto

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ option java_package = "io.substrait.proto";
1515
//
1616
// The value 0 represents the system-preferred variation and is a valid reference value.
1717
message Type {
18+
reserved 14, 17, 29;
19+
1820
oneof kind {
1921
Boolean bool = 1;
2022
I8 i8 = 2;
@@ -25,16 +27,10 @@ message Type {
2527
FP64 fp64 = 11;
2628
String string = 12;
2729
Binary binary = 13;
28-
// Deprecated in favor of `PrecisionTimestamp precision_timestamp`
29-
Timestamp timestamp = 14 [deprecated = true];
3030
Date date = 16;
31-
// Deprecated in favor of `PrecisionTime precision_time`
32-
Time time = 17 [deprecated = true];
3331
IntervalYear interval_year = 19;
3432
IntervalDay interval_day = 20;
3533
IntervalCompound interval_compound = 35;
36-
// Deprecated in favor of `PrecisionTimestampTZ precision_timestamp_tz`
37-
TimestampTZ timestamp_tz = 29 [deprecated = true];
3834
UUID uuid = 32;
3935

4036
FixedChar fixed_char = 21;
@@ -113,26 +109,11 @@ message Type {
113109
Nullability nullability = 2;
114110
}
115111

116-
message Timestamp {
117-
uint32 type_variation_reference = 1;
118-
Nullability nullability = 2;
119-
}
120-
121112
message Date {
122113
uint32 type_variation_reference = 1;
123114
Nullability nullability = 2;
124115
}
125116

126-
message Time {
127-
uint32 type_variation_reference = 1;
128-
Nullability nullability = 2;
129-
}
130-
131-
message TimestampTZ {
132-
uint32 type_variation_reference = 1;
133-
Nullability nullability = 2;
134-
}
135-
136117
// An interval consisting of years and months
137118
message IntervalYear {
138119
uint32 type_variation_reference = 1;

site/docs/extensions/index.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,7 @@ A function signature uniquely identifies a function implementation within a sing
9898
| string | str |
9999
| binary | vbin |
100100
| boolean | bool |
101-
| timestamp | ts |
102-
| timestamp_tz | tstz |
103101
| date | date |
104-
| time | time |
105102
| interval_year | iyear |
106103
| interval_day | iday |
107104
| interval_compound | icompound |
@@ -126,7 +123,7 @@ A function signature uniquely identifies a function implementation within a sing
126123
| ------------------------------------------------- | ------------------- |
127124
| `add(optional enumeration, i8, i8) => i8` | `add:i8_i8` |
128125
| `avg(fp32) => fp32` | `avg:fp32` |
129-
| `extract(required enumeration, timestamp) => i64` | `extract:req_ts` |
126+
| `extract(required enumeration, precision_timestamp<6>) => i64` | `extract:req_pts` |
130127
| `sum(any1) => any1` | `sum:any` |
131128
| `concat(str...) => str` | `concat:str` |
132129
| `transform(list<any1>, func<any1 -> any2>) => list<any2>` | `transform:list_func` |

site/docs/types/type_classes.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ Simple type classes are those that don't support any form of configuration. For
2121
| fp64 | An 8-byte double-precision floating point number with the same range and precision as defined for the [IEEE 754 64-bit floating-point format](https://standards.ieee.org/ieee/754/6210/). | `double`
2222
| string | A unicode string of text, [0..2,147,483,647] UTF-8 bytes in length. | `string`
2323
| binary | A binary value, [0..2,147,483,647] bytes in length. | `binary`
24-
| timestamp | A naive timestamp with microsecond precision. Does not include timezone information and can thus not be unambiguously mapped to a moment on the timeline without context. Similar to naive datetime in Python. | `int64` microseconds since 1970-01-01 00:00:00.000000 (in an unspecified timezone)
25-
| timestamp_tz | A timezone-aware timestamp with microsecond precision. Similar to timezone-aware datetime in Python. | `int64` microseconds since 1970-01-01 00:00:00.000000 UTC
2624
| date | A date within [1000-01-01..9999-12-31]. | `int32` days since `1970-01-01`
27-
| time | A time since the beginning of any day. Range of [0..86,399,999,999] microseconds; leap seconds need not be supported. | `int64` microseconds past midnight
2825
| interval_year | Interval year to month. Supports a range of [-10,000..10,000] years with month precision (= [-120,000..120,000] months). Usually stored as separate integers for years and months, but only the total number of months is significant, i.e. `1y 0m` is considered equal to `0y 12m` or `1001y -12000m`. | `int32` years and `int32` months, with the added constraint that each component can never independently specify more than 10,000 years, even if the components have opposite signs (e.g. `-10000y 200000m` is **not** allowed)
2926
| uuid | A universally-unique identifier composed of 128 bits. Typically presented to users in the following hexadecimal format: `c48ffa9e-64f4-44cb-ae47-152b4e60e77b`. Any 128-bit value is allowed, without specific adherence to RFC4122. | 16-byte `binary`
3027

site/docs/types/type_parsing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Structs are unique from other types because they have an arbitrary number of par
3737

3838
```
3939
// Struct
40-
struct?<string, i8, i32?, timestamp_tz>
40+
struct?<string, i8, i32?, precision_timestamp_tz<6>>
4141

4242
// Named structs are not yet supported in the text format.
4343
```

tests/README.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ literal := <literal_value>::<datatype>
109109
result := <substrait_error> | <literal>
110110
options := <option>, <option>, ... <option>
111111
option := <option_name>:<option_value>
112-
literal_value := string | integer | decimal | float | boolean | date | time | timestamp | timestamp_tz | interval year | interval days | null
112+
literal_value := string | integer | decimal | float | boolean | date | interval year | interval days | null
113113
datatype := <basic_type> | <parametrized_type> | <complex_type>
114-
basic_type := bool | i8 | i16 | i32 | i64 | f32 | f64 | str | date | time | ts | tstz | iyear | vbin | <parametrized_type>
114+
basic_type := bool | i8 | i16 | i32 | i64 | f32 | f64 | str | date | iyear | vbin | <parametrized_type>
115115
parametrized_type := fchar<int> | vchar<int> | dec<int,int> | fbin<int> | iday<int> | icompound<int> | pt<int> | pts<int> | ptstz<int> | func<params -> datatype>
116116
params := datatype | (datatype(, datatype)*)
117117
complex_type := <struct> | <list> | <map>
@@ -152,9 +152,9 @@ Integers are represented as sequences of digits. Negative numbers are preceded b
152152
All date and time literals use ISO 8601 format:
153153

154154
- **date**: `YYYY-MM-DD`, example: `2021-01-01`
155-
- **time**: `HH:MM:SS[.fraction]`, example: `12:00:00.000`
156-
- **timestamp**: `YYYY-MM-DD HH:MM:SS[.fraction]`, example: `2021-01-01 12:00:00`
157-
- **timestamp_tz**: `YYYY-MM-DD HH:MM:SS[.fraction]±HH:MM`, example: `2021-01-01 12:00:00+05:30`
155+
- **precision_time**: `HH:MM:SS[.fraction]`, example: `12:00:00.000`
156+
- **precision_timestamp**: `YYYY-MM-DD HH:MM:SS[.fraction]`, example: `2021-01-01 12:00:00`
157+
- **precision_timestamp_tz**: `YYYY-MM-DD HH:MM:SS[.fraction]±HH:MM`, example: `2021-01-01 12:00:00+05:30`
158158
- **interval year**: `'P[n]Y[n]M'`, example: `'P2Y3M'` (2 years, 3 months)
159159
- **interval days**: `'P[n]DT[n]H[n]M[n]S'`, example: `'P2DT3H2M9S'` (2 days, 3 hours, 2 minutes, 9 seconds)
160160
ex2: 'P1DT2H3M4.45::iday<3>' (1 day, 2 hours, 3 minutes, 4 seconds, 450 milliseconds)`
@@ -182,15 +182,12 @@ Use short names listed in https://substrait.io/extensions/#function-signature-co
182182
- **vchar**: Variable-length string `varchar<N>`
183183
- **vbin**: Fixed-length binary `fixedbinary<N>`
184184
- **date**: Date
185-
- **time**: Time
186-
- **ts**: Timestamp
187-
- **tstz**: Timestamp with timezone
188185
- **iyear**: Interval year
189-
- **iday**: Interval days
186+
- **iday**: Interval days `interval_day<P>`
190187
- **icompound**: Interval compound
191-
- **pt**: Precision Time
192-
- **pts**: Precision Timestamp
193-
- **ptstz**: Precision Timestamp with timezone
188+
- **pt**: Precision Time `precision_time<P>`
189+
- **pts**: Precision Timestamp `precision_timestamp<P>`
190+
- **ptstz**: Precision Timestamp with timezone `precision_timestamp_tz<P>`
194191

195192

196193
### Nullability

0 commit comments

Comments
 (0)