-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathyads_spec_latest.json
More file actions
473 lines (473 loc) · 13 KB
/
yads_spec_latest.json
File metadata and controls
473 lines (473 loc) · 13 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
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "yads spec",
"description": "A schema for yads spec definitions.",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The fully qualified name of the table, including catalog and database/schema. Follows the format: [catalog].[database].[table]."
},
"version": {
"type": "integer",
"description": "Registry-assigned monotonic integer version for tracking changes."
},
"yads_spec_version": {
"type": "string",
"description": "Version of the yads specification format itself."
},
"description": {
"type": "string",
"description": "An optional description of the table defined by the spec."
},
"external": {
"type": "boolean",
"description": "Flag to emit a CREATE EXTERNAL statement from SQL DDL converters. Defaults to False.",
"default": false
},
"metadata": {
"type": "object",
"description": "Optional metadata about the table as a simple key-value store."
},
"storage": {
"type": "object",
"description": "Defines the physical storage properties of the table.",
"properties": {
"format": {
"type": "string",
"description": "The table format (e.g., 'iceberg', 'orc', 'csv'). Translates to USING or STORED AS in SQL."
},
"location": {
"type": "string"
},
"tbl_properties": {
"type": "object",
"description": "Key-value pairs for the TBLPROPERTIES clause."
}
},
"additionalProperties": false
},
"partitioned_by": {
"type": "array",
"description": "Defines the table's partitioning scheme.",
"items": {
"$ref": "#/definitions/transformed_column"
}
},
"table_constraints": {
"type": "array",
"description": "A list of table-level constraints, such as composite primary or foreign keys.",
"items": {
"$ref": "#/definitions/table_constraint"
}
},
"columns": {
"type": "array",
"items": {
"$ref": "#/definitions/named_column"
}
}
},
"required": ["name", "version", "yads_spec_version", "columns"],
"additionalProperties": false,
"definitions": {
"type": {
"type": "string",
"description": "The type of a column or field.",
"enum": [
"str",
"STR",
"string",
"STRING",
"text",
"TEXT",
"varchar",
"VARCHAR",
"char",
"CHAR",
"int8",
"INT8",
"uint8",
"UINT8",
"tinyint",
"TINYINT",
"byte",
"BYTE",
"int16",
"INT16",
"uint16",
"UINT16",
"smallint",
"SMALLINT",
"short",
"SHORT",
"int32",
"INT32",
"uint32",
"UINT32",
"int",
"INT",
"integer",
"INTEGER",
"int64",
"INT64",
"uint64",
"UINT64",
"bigint",
"BIGINT",
"long",
"LONG",
"float",
"FLOAT",
"float16",
"FLOAT16",
"float32",
"FLOAT32",
"float64",
"FLOAT64",
"double",
"DOUBLE",
"decimal",
"DECIMAL",
"numeric",
"NUMERIC",
"bool",
"BOOL",
"boolean",
"BOOLEAN",
"blob",
"BLOB",
"binary",
"BINARY",
"bytes",
"BYTES",
"date",
"DATE",
"time",
"TIME",
"datetime",
"DATETIME",
"timestamp",
"TIMESTAMP",
"timestamptz",
"TIMESTAMPTZ",
"timestamp_tz",
"TIMESTAMP_TZ",
"timestampltz",
"TIMESTAMPLTZ",
"timestamp_ltz",
"TIMESTAMP_LTZ",
"timestampntz",
"TIMESTAMPNTZ",
"timestamp_ntz",
"TIMESTAMP_NTZ",
"duration",
"DURATION",
"interval",
"INTERVAL",
"array",
"ARRAY",
"list",
"LIST",
"struct",
"STRUCT",
"record",
"RECORD",
"map",
"MAP",
"dictionary",
"DICTIONARY",
"json",
"JSON",
"geometry",
"GEOMETRY",
"geography",
"GEOGRAPHY",
"uuid",
"UUID",
"void",
"VOID",
"null",
"NULL",
"variant",
"VARIANT",
"tensor",
"TENSOR"
]
},
"type_spec": {
"type": "object",
"description": "A type specification that can include type, parameters, and nested type definitions.",
"properties": {
"type": {
"$ref": "#/definitions/type"
},
"params": {
"type": "object",
"description": "Parameters for parameterized types, such as precision and scale for decimals.",
"properties": {
"length": {
"type": "integer",
"description": "The length of a string or binary column."
},
"bits": {
"type": "integer",
"description": "Bit width for the type. One of 8, 16, 32, 64, 128, 256.",
"enum": [8, 16, 32, 64, 128, 256]
},
"signed": {
"type": "boolean",
"description": "Signedness for integer types. True for signed, False for unsigned. Defaults to True.",
"default": true
},
"precision": {
"type": "integer",
"description": "The precision of a decimal column."
},
"scale": {
"type": "integer",
"description": "The scale of a decimal column. May be negative to indicate rounding to the left of the decimal point."
},
"unit": {
"type": "string",
"description": "Time precision unit. One of s, ms, us, ns.",
"enum": ["s", "ms", "us", "ns"]
},
"tz": {
"type": "string",
"description": "IANA timezone string for timestamp with timezone (timestamptz)."
},
"size": {
"type": "integer",
"description": "The maximum number of elements in an array (fixed-size)."
},
"keys_sorted": {
"type": "boolean",
"description": "Whether the map type has sorted keys.",
"default": false
},
"interval_start": {
"type": "string",
"description": "The start of an interval for an interval column.",
"enum": [
"year",
"YEAR",
"month",
"MONTH",
"day",
"DAY",
"hour",
"HOUR",
"minute",
"MINUTE",
"second",
"SECOND"
]
},
"interval_end": {
"type": "string",
"description": "The end of an interval for an interval column.",
"enum": [
"year",
"YEAR",
"month",
"MONTH",
"day",
"DAY",
"hour",
"HOUR",
"minute",
"MINUTE",
"second",
"SECOND"
]
},
"shape": {
"type": "array",
"description": "Fixed dimensions for tensor type.",
"items": {
"type": "integer",
"minimum": 1
},
"minItems": 1
},
"additionalProperties": false
}
},
"element": {
"description": "The type of the elements in an array or tensor.",
"$ref": "#/definitions/type_spec"
},
"fields": {
"type": "array",
"description": "The fields of a struct.",
"items": {
"$ref": "#/definitions/named_column"
}
},
"key": {
"description": "The type of a key in a map.",
"$ref": "#/definitions/type_spec"
},
"value": {
"description": "The type of a value in a map.",
"$ref": "#/definitions/type_spec"
}
},
"required": ["type"]
},
"column": {
"allOf": [
{ "$ref": "#/definitions/type_spec" },
{
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Optional name of the column or field."
},
"description": {
"type": "string",
"description": "Optional description of the column or field."
},
"constraints": {
"$ref": "#/definitions/constraints"
},
"generated_as": {
"$ref": "#/definitions/transformed_column"
},
"metadata": {
"type": "object"
}
}
}
]
},
"transformed_column": {
"type": "object",
"description": "A column that may have a transformation function applied to it. Used for both partitioning/clustering and generated column specifications.",
"properties": {
"column": { "type": "string" },
"transform": { "type": "string" },
"transform_args": {
"type": "array",
"description": "A list of unnamed arguments for the transformation function."
}
},
"required": ["column"],
"additionalProperties": false
},
"named_column": {
"type": "object",
"description": "A named column definition.",
"allOf": [
{ "$ref": "#/definitions/column" },
{ "required": ["name"] }
]
},
"table_constraint": {
"type": "object",
"description": "A table-level constraint, such as a primary or foreign key.",
"properties": {
"type": {
"type": "string",
"enum": ["primary_key", "foreign_key"]
},
"name": {
"type": "string"
},
"columns": {
"type": "array",
"items": {
"type": "string"
}
},
"references": {
"type": "object",
"properties": {
"table": {
"type": "string"
},
"columns": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": ["table"],
"additionalProperties": false
}
},
"required": ["type", "columns", "name"],
"additionalProperties": false
},
"constraints": {
"type": "object",
"properties": {
"not_null": {
"type": "boolean",
"description": "Whether the column is not nullable."
},
"primary_key": {
"type": "boolean",
"description": "Whether the column is a primary key."
},
"identity": {
"type": "object",
"description": "Defines an identity column, often used for auto-incrementing keys.",
"properties": {
"always": {
"type": "boolean",
"description": "Whether the identity column is always generated.",
"default": true
},
"start": {
"type": "integer",
"description": "The starting value for the identity column."
},
"increment": {
"type": "integer",
"description": "The increment value for the identity column."
}
}
},
"foreign_key": {
"type": "object",
"description": "Defines a foreign key constraint.",
"properties": {
"name": {
"type": "string",
"description": "The name of the foreign key constraint."
},
"references": {
"type": "object",
"description": "The referenced table and columns for the foreign key constraint.",
"properties": {
"table": {
"type": "string",
"description": "The name of the referenced table."
},
"columns": {
"type": "array",
"description": "The columns in the referenced table that are referenced by the foreign key constraint.",
"items": {
"type": "string",
"description": "The name of the referenced column."
}
}
},
"required": ["table"]
}
},
"required": ["references"],
"additionalProperties": false
},
"default": {
"description": "The default value for the column."
}
},
"additionalProperties": false
}
}
}