Skip to content

Commit 1eb9681

Browse files
committed
feat(evolution): support v3 column default values in UpdateSchema (4/4)
AddColumn / AddRequiredColumn now accept an optional default value, used as both the initial-default and write-default of the new column; a non-null default also lets a required column be added (or an added column be made required) without AllowIncompatibleChanges(). UpdateColumnDefault sets or clears the write-default. Defaults are cast to the column type (rejecting uncastable or out-of-range values) and preserved across rename / doc / type updates and nested field-id reassignment. Part 4 of the v3 column-default-values work (POC #731), built on #746.
1 parent 93577b3 commit 1eb9681

5 files changed

Lines changed: 598 additions & 50 deletions

File tree

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
{
2+
"format-version": 3,
3+
"table-uuid": "9c12d441-03fe-4693-9a96-a0705ddf69c1",
4+
"location": "s3://bucket/test/location",
5+
"last-sequence-number": 34,
6+
"next-row-id": 0,
7+
"last-updated-ms": 1602638573590,
8+
"last-column-id": 3,
9+
"current-schema-id": 1,
10+
"schemas": [
11+
{
12+
"type": "struct",
13+
"schema-id": 0,
14+
"fields": [
15+
{
16+
"id": 1,
17+
"name": "x",
18+
"required": true,
19+
"type": "long"
20+
}
21+
]
22+
},
23+
{
24+
"type": "struct",
25+
"schema-id": 1,
26+
"identifier-field-ids": [
27+
1,
28+
2
29+
],
30+
"fields": [
31+
{
32+
"id": 1,
33+
"name": "x",
34+
"required": true,
35+
"type": "long"
36+
},
37+
{
38+
"id": 2,
39+
"name": "y",
40+
"required": true,
41+
"type": "long",
42+
"doc": "comment"
43+
},
44+
{
45+
"id": 3,
46+
"name": "z",
47+
"required": true,
48+
"type": "long"
49+
}
50+
]
51+
}
52+
],
53+
"default-spec-id": 0,
54+
"partition-specs": [
55+
{
56+
"spec-id": 0,
57+
"fields": [
58+
{
59+
"name": "x",
60+
"transform": "identity",
61+
"source-id": 1,
62+
"field-id": 1000
63+
}
64+
]
65+
}
66+
],
67+
"last-partition-id": 1000,
68+
"default-sort-order-id": 3,
69+
"sort-orders": [
70+
{
71+
"order-id": 3,
72+
"fields": [
73+
{
74+
"transform": "identity",
75+
"source-id": 2,
76+
"direction": "asc",
77+
"null-order": "nulls-first"
78+
},
79+
{
80+
"transform": "bucket[4]",
81+
"source-id": 3,
82+
"direction": "desc",
83+
"null-order": "nulls-last"
84+
}
85+
]
86+
}
87+
],
88+
"properties": {},
89+
"current-snapshot-id": 3055729675574597004,
90+
"snapshots": [
91+
{
92+
"snapshot-id": 3051729675574597004,
93+
"timestamp-ms": 1515100955770,
94+
"sequence-number": 0,
95+
"summary": {
96+
"operation": "append"
97+
},
98+
"manifest-list": "s3://a/b/1.avro"
99+
},
100+
{
101+
"snapshot-id": 3055729675574597004,
102+
"parent-snapshot-id": 3051729675574597004,
103+
"timestamp-ms": 1555100955770,
104+
"sequence-number": 1,
105+
"summary": {
106+
"operation": "append"
107+
},
108+
"manifest-list": "s3://a/b/2.avro",
109+
"schema-id": 1
110+
}
111+
],
112+
"snapshot-log": [
113+
{
114+
"snapshot-id": 3051729675574597004,
115+
"timestamp-ms": 1515100955770
116+
},
117+
{
118+
"snapshot-id": 3055729675574597004,
119+
"timestamp-ms": 1555100955770
120+
}
121+
],
122+
"metadata-log": []
123+
}

0 commit comments

Comments
 (0)