liurenjie1024 commented on code in PR #57:
URL: https://github.com/apache/iceberg-rust/pull/57#discussion_r1319737798
##########
crates/iceberg/src/spec/table_metadata.rs:
##########
@@ -346,21 +349,29 @@ pub(super) mod _serde {
} else {
value.current_snapshot_id
};
+ let schemas = HashMap::from_iter(
+ value
+ .schemas
+ .into_iter()
+ .map(|schema| Ok((schema.schema_id,
Arc::new(schema.try_into()?))))
+ .collect::<Result<Vec<_>, Error>>()?,
+ );
Ok(TableMetadata {
format_version: FormatVersion::V2,
table_uuid: value.table_uuid,
location: value.location,
last_sequence_number: value.last_sequence_number,
last_updated_ms: value.last_updated_ms,
last_column_id: value.last_column_id,
- schemas: HashMap::from_iter(
- value
- .schemas
- .into_iter()
- .map(|schema| Ok((schema.schema_id,
Arc::new(schema.try_into()?))))
- .collect::<Result<Vec<_>, Error>>()?,
- ),
- current_schema_id: value.current_schema_id,
+ current_schema_id: if
schemas.keys().contains(&value.current_schema_id) {
+ Ok(value.current_schema_id)
+ } else {
+ Err(self::Error::new(
+ ErrorKind::DataInvalid,
+ "No schema exists with the current schema id.",
Review Comment:
```suggestion
format!("No schema exists with the current schema
id: {}", *value.current_schema_id),
```
--
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]