Skip to content

Commit 1f49c95

Browse files
committed
Merge branch 'feat/schema-reassign-field-ids'
1 parent cda4a0c commit 1f49c95

File tree

4 files changed

+411
-32
lines changed

4 files changed

+411
-32
lines changed

crates/iceberg/src/arrow/schema.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -826,8 +826,8 @@ mod tests {
826826

827827
fn arrow_schema_for_arrow_schema_to_schema_test() -> ArrowSchema {
828828
let fields = Fields::from(vec![
829-
simple_field("key", DataType::Int32, false, "17"),
830-
simple_field("value", DataType::Utf8, true, "18"),
829+
simple_field("key", DataType::Int32, false, "28"),
830+
simple_field("value", DataType::Utf8, true, "29"),
831831
]);
832832

833833
let r#struct = DataType::Struct(fields);
@@ -1057,9 +1057,9 @@ mod tests {
10571057
"required": true,
10581058
"type": {
10591059
"type": "map",
1060-
"key-id": 17,
1060+
"key-id": 28,
10611061
"key": "int",
1062-
"value-id": 18,
1062+
"value-id": 29,
10631063
"value-required": false,
10641064
"value": "string"
10651065
}
@@ -1110,8 +1110,8 @@ mod tests {
11101110

11111111
fn arrow_schema_for_schema_to_arrow_schema_test() -> ArrowSchema {
11121112
let fields = Fields::from(vec![
1113-
simple_field("key", DataType::Int32, false, "17"),
1114-
simple_field("value", DataType::Utf8, true, "18"),
1113+
simple_field("key", DataType::Int32, false, "28"),
1114+
simple_field("value", DataType::Utf8, true, "29"),
11151115
]);
11161116

11171117
let r#struct = DataType::Struct(fields);
@@ -1200,7 +1200,7 @@ mod tests {
12001200
),
12011201
simple_field("map", map, false, "16"),
12021202
simple_field("struct", r#struct, false, "17"),
1203-
simple_field("uuid", DataType::FixedSizeBinary(16), false, "26"),
1203+
simple_field("uuid", DataType::FixedSizeBinary(16), false, "30"),
12041204
])
12051205
}
12061206

@@ -1344,9 +1344,9 @@ mod tests {
13441344
"required": true,
13451345
"type": {
13461346
"type": "map",
1347-
"key-id": 17,
1347+
"key-id": 28,
13481348
"key": "int",
1349-
"value-id": 18,
1349+
"value-id": 29,
13501350
"value-required": false,
13511351
"value": "string"
13521352
}
@@ -1380,7 +1380,7 @@ mod tests {
13801380
}
13811381
},
13821382
{
1383-
"id":26,
1383+
"id":30,
13841384
"name":"uuid",
13851385
"required":true,
13861386
"type":"uuid"

crates/iceberg/src/spec/datatypes.rs

+6
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,12 @@ impl NestedField {
668668
self.write_default = Some(value);
669669
self
670670
}
671+
672+
/// Set the id of the field.
673+
pub(crate) fn with_id(mut self, id: i32) -> Self {
674+
self.id = id;
675+
self
676+
}
671677
}
672678

673679
impl fmt::Display for NestedField {

0 commit comments

Comments
 (0)