kevinjqliu commented on code in PR #1849:
URL: https://github.com/apache/iceberg-rust/pull/1849#discussion_r2612942255
##########
crates/iceberg/src/metadata_columns.rs:
##########
@@ -32,11 +32,68 @@ use crate::{Error, ErrorKind, Result};
/// Reserved field ID for the file path (_file) column per Iceberg spec
pub const RESERVED_FIELD_ID_FILE: i32 = i32::MAX - 1;
+/// Reserved field ID for the position (_pos) column per Iceberg spec
+pub const RESERVED_FIELD_ID_POS: i32 = i32::MAX - 2;
+
+/// Reserved field ID for the deleted (_deleted) column per Iceberg spec
+pub const RESERVED_FIELD_ID_DELETED: i32 = i32::MAX - 3;
+
+/// Reserved field ID for the spec ID (_spec_id) column per Iceberg spec
+pub const RESERVED_FIELD_ID_SPEC_ID: i32 = i32::MAX - 4;
+
+/// Reserved field ID for the file path in position delete files
+pub const RESERVED_FIELD_ID_DELETE_FILE_PATH: i32 = i32::MAX - 101;
+
+/// Reserved field ID for the position in position delete files
+pub const RESERVED_FIELD_ID_DELETE_FILE_POS: i32 = i32::MAX - 102;
+
Review Comment:
nit: add `row` for completeness?
##########
crates/iceberg/src/metadata_columns.rs:
##########
@@ -32,11 +32,68 @@ use crate::{Error, ErrorKind, Result};
/// Reserved field ID for the file path (_file) column per Iceberg spec
pub const RESERVED_FIELD_ID_FILE: i32 = i32::MAX - 1;
+/// Reserved field ID for the position (_pos) column per Iceberg spec
+pub const RESERVED_FIELD_ID_POS: i32 = i32::MAX - 2;
+
+/// Reserved field ID for the deleted (_deleted) column per Iceberg spec
+pub const RESERVED_FIELD_ID_DELETED: i32 = i32::MAX - 3;
+
+/// Reserved field ID for the spec ID (_spec_id) column per Iceberg spec
+pub const RESERVED_FIELD_ID_SPEC_ID: i32 = i32::MAX - 4;
+
Review Comment:
nit: add `_partition` here for completeness?
##########
crates/iceberg/src/spec/manifest/_serde.rs:
##########
@@ -245,8 +245,19 @@ struct BytesEntry {
fn parse_bytes_entry(v: Vec<BytesEntry>, schema: &Schema) ->
Result<HashMap<i32, Datum>, Error> {
let mut m = HashMap::with_capacity(v.len());
for entry in v {
- // We ignore the entry if the field is not found in the schema, due to
schema evolution.
- if let Some(field) = schema.field_by_id(entry.key) {
+ // First try to find the field in the schema, or check if it's a
reserved metadata field
+ let field_opt = schema.field_by_id(entry.key);
+ let metadata_field;
+ let field = if let Some(f) = field_opt {
+ Some(f)
+ } else if let Ok(f) = metadata_columns::get_metadata_field(entry.key) {
+ metadata_field = f;
+ Some(&metadata_field)
+ } else {
+ None
+ };
Review Comment:
```suggestion
let field = schema.field_by_id(entry.key)
.or_else(||
metadata_columns::get_metadata_field(entry.key).ok());
```
how about this?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]