y0psolo commented on code in PR #46:
URL: https://github.com/apache/iceberg-rust/pull/46#discussion_r1308919404
##########
crates/iceberg/src/spec/schema.rs:
##########
@@ -643,6 +655,27 @@ pub(super) mod _serde {
pub fields: StructType,
}
+ /// Helper to serialize/deserializa Schema
+ impl TryFrom<SchemaEnum> for Schema {
+ type Error = Error;
+ fn try_from(value: SchemaEnum) -> Result<Self> {
+ match value {
+ SchemaEnum::V2(value) => value.try_into(),
+ SchemaEnum::V1(value) => value.try_into(),
+ }
+ }
+ }
+
+ impl From<Schema> for SchemaEnum {
+ fn from(value: Schema) -> Self {
+ if value.schema_id == 0 {
Review Comment:
Thanks. I will update. Less code and much simpler i like it.
Moreover difference between V1 and V2 is very thin.
--
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]