Repository navigation
Expand file tree
/
Copy pathtype.proto
More file actions
304 lines (258 loc) · 8.38 KB
/
Copy pathtype.proto
File metadata and controls
304 lines (258 loc) · 8.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
// SPDX-License-Identifier: Apache-2.0
syntax = "proto3";
package substrait;
import "google/protobuf/empty.proto";
option csharp_namespace = "Substrait.Protobuf";
option go_package = "github.com/substrait-io/substrait-protobuf/go/substraitpb";
option java_multiple_files = true;
option java_package = "io.substrait.proto";
// Note: type_variation_reference fields within Type messages reference a
// type_variation_anchor defined in the plan's extension declarations.
//
// The value 0 represents the system-preferred variation and is a valid reference value.
message Type {
reserved 14, 17, 29, 31;
oneof kind {
Boolean bool = 1;
I8 i8 = 2;
I16 i16 = 3;
I32 i32 = 5;
I64 i64 = 7;
FP32 fp32 = 10;
FP64 fp64 = 11;
String string = 12;
Binary binary = 13;
Date date = 16;
IntervalYear interval_year = 19;
IntervalDay interval_day = 20;
IntervalCompound interval_compound = 35;
UUID uuid = 32;
FixedChar fixed_char = 21;
VarChar varchar = 22;
FixedBinary fixed_binary = 23;
Decimal decimal = 24;
PrecisionTime precision_time = 36;
PrecisionTimestamp precision_timestamp = 33;
PrecisionTimestampTZ precision_timestamp_tz = 34; // value is since UNIX epoch in UTC
Struct struct = 25;
List list = 27;
Map map = 28;
Func func = 38;
// A placeholder type whose concrete type has not yet been bound.
// Unbound may be used where a concrete type would normally appear in
// partially bound plans and expressions, and must be bound to a
// concrete type before execution. Substrait defines no runtime semantics
// for values whose type is unbound.
Unbound unbound = 39;
UserDefined user_defined = 30;
// Reference an aliased type in `Plan.type_aliases`.
TypeAliasReference alias = 37;
}
enum Nullability {
NULLABILITY_UNSPECIFIED = 0;
NULLABILITY_NULLABLE = 1;
NULLABILITY_REQUIRED = 2;
}
message Boolean {
uint32 type_variation_reference = 1;
Nullability nullability = 2;
}
message I8 {
uint32 type_variation_reference = 1;
Nullability nullability = 2;
}
message I16 {
uint32 type_variation_reference = 1;
Nullability nullability = 2;
}
message I32 {
uint32 type_variation_reference = 1;
Nullability nullability = 2;
}
message I64 {
uint32 type_variation_reference = 1;
Nullability nullability = 2;
}
message FP32 {
uint32 type_variation_reference = 1;
Nullability nullability = 2;
}
message FP64 {
uint32 type_variation_reference = 1;
Nullability nullability = 2;
}
message String {
uint32 type_variation_reference = 1;
Nullability nullability = 2;
}
message Binary {
uint32 type_variation_reference = 1;
Nullability nullability = 2;
}
message Date {
uint32 type_variation_reference = 1;
Nullability nullability = 2;
}
// An interval consisting of years and months
message IntervalYear {
uint32 type_variation_reference = 1;
Nullability nullability = 2;
}
// An interval consisting of days, seconds, and microseconds
message IntervalDay {
uint32 type_variation_reference = 1;
Nullability nullability = 2;
// Sub-second precision, 0 means the value given is in seconds, 3 is milliseconds, 6 microseconds, 9 is nanoseconds, 12 is picoseconds
// Implementations should reject an unset precision.
optional int32 precision = 3;
}
// An interval consisting of the components of both IntervalYear and IntervalDay
message IntervalCompound {
uint32 type_variation_reference = 1;
Nullability nullability = 2;
// Sub-second precision, 0 means the value given is in seconds, 3 is milliseconds, 6 microseconds, 9 is nanoseconds, 12 is picoseconds
int32 precision = 3;
}
message UUID {
uint32 type_variation_reference = 1;
Nullability nullability = 2;
}
// Start compound types.
message FixedChar {
int32 length = 1;
uint32 type_variation_reference = 2;
Nullability nullability = 3;
}
message VarChar {
int32 length = 1;
uint32 type_variation_reference = 2;
Nullability nullability = 3;
}
message FixedBinary {
int32 length = 1;
uint32 type_variation_reference = 2;
Nullability nullability = 3;
}
message Decimal {
int32 scale = 1;
int32 precision = 2;
uint32 type_variation_reference = 3;
Nullability nullability = 4;
}
message PrecisionTime {
// Sub-second precision, 0 means the value given is in seconds, 3 is milliseconds, 6 microseconds, 9 is nanoseconds, 12 is picoseconds
int32 precision = 1;
uint32 type_variation_reference = 2;
Nullability nullability = 3;
}
message PrecisionTimestamp {
// Sub-second precision, 0 means the value given is in seconds, 3 is milliseconds, 6 microseconds, 9 is nanoseconds, 12 is picoseconds
int32 precision = 1;
uint32 type_variation_reference = 2;
Nullability nullability = 3;
}
message PrecisionTimestampTZ {
// Sub-second precision, 0 means the value given is in seconds, 3 is milliseconds, 6 microseconds, 9 is nanoseconds, 12 is picoseconds
int32 precision = 1;
uint32 type_variation_reference = 2;
Nullability nullability = 3;
}
message Struct {
repeated Type types = 1;
uint32 type_variation_reference = 2;
Nullability nullability = 3;
}
message List {
Type type = 1;
uint32 type_variation_reference = 2;
Nullability nullability = 3;
}
message Map {
Type key = 1;
Type value = 2;
uint32 type_variation_reference = 3;
Nullability nullability = 4;
}
message Unbound {}
// A function type for higher-order functions.
// Represents a function that takes parameters of specified types and
// returns a value of a specified type.
message Func {
// Types of parameters this function type accepts.
repeated Type parameter_types = 1;
// Return type of the function.
Type return_type = 2;
// Nullability of the function value itself, not its return type.
// A nullable function type (e.g., func?<i32 -> i32>) means the function
// reference may be null. This is distinct from the return type's
// nullability (e.g., func<i32 -> i32?> where the function always exists
// but may return null).
Nullability nullability = 3;
}
message UserDefined {
// References a type_anchor defined in the plan's extension declarations.
uint32 type_reference = 1;
uint32 type_variation_reference = 2;
Nullability nullability = 3;
repeated Parameter type_parameters = 4;
}
message Parameter {
oneof parameter {
// Explicitly null/unspecified parameter, to select the default value (if
// any).
google.protobuf.Empty null = 1;
// Data type parameters, like the i32 in LIST<i32>.
Type data_type = 2;
// Value parameters, like the 10 in VARCHAR<10>.
bool boolean = 3;
int64 integer = 4;
string enum = 5;
string string = 6;
}
}
message TypeAliasReference {
uint32 type_alias_reference = 1;
// Nullability of the referenced type alias. Must be specified.
Nullability nullability = 2;
}
}
message TypeAlias {
// A surrogate key used in the context of a single plan to reference a
// specific type alias.
// 0 is a valid anchor/reference, but prefer non-zero values for ergonomics.
uint32 type_alias_anchor = 1;
// A concrete type to be aliased.
//
// * All type parameters must be specified.
// * Cannot directly be another alias.
// * Type parameters can reference other aliased types as long as no circular dependencies are introduced.
// * Nullability of aliased type is **ignored**. Nullability must be specified when the aliased type is referenced.
// * Type variation may be specified in the aliased type.
Type type = 2;
}
// A message for modeling name/type pairs.
//
// Useful for representing relation schemas.
//
// Notes:
//
// * The names field is in depth-first order.
//
// For example a schema such as:
//
// a: int64
// b: struct<c: float32, d: string>
//
// would have a `names` field that looks like:
//
// ["a", "b", "c", "d"]
//
// * Only struct fields are contained in this field's elements,
// * Map keys should be traversed first, then values when producing/consuming
// * When used to represent a relation schema, the outermost struct's
// nullability should be NULLABILITY_REQUIRED.
message NamedStruct {
// list of names in dfs order
repeated string names = 1;
Type.Struct struct = 2;
}