ZENOTME commented on code in PR #80:
URL: https://github.com/apache/iceberg-rust/pull/80#discussion_r1363200948
##########
crates/iceberg/src/spec/values.rs:
##########
@@ -995,7 +995,7 @@ mod tests {
assert_eq!(literal, expected_literal);
let mut writer = apache_avro::Writer::new(&schema, Vec::new());
- writer.append_ser(bytes).unwrap();
+ writer.append_ser(Into::<ByteBuf>::into(literal)).unwrap();
Review Comment:
> The PR looks good to me overall, but I'm slightly concerned about the use
of Into::<ByteBuf>::into(literal). Will our users have to write code in this
manner? Or does it occur internally?
One choice is to impl `impl From<Literal> for Vec<u8>` instead of `impl
From<Literal> for ByteBuf` and then we can convert to ByteBuf by
`ByteBuf::from(literal)`
Another choice may be:
```
let bytes: BytesBuf = literal.into();
writer.append_ser(bytes)
```
Actually in the case where the type is BytesBuf explicitlly, we don't need `
Into::<ByteBuf>::into(literal)`.🤔
> when I provide a impl From<Literal> for Vec<u8>.
This way looks good to me.
##########
crates/iceberg/src/spec/values.rs:
##########
@@ -995,7 +995,7 @@ mod tests {
assert_eq!(literal, expected_literal);
let mut writer = apache_avro::Writer::new(&schema, Vec::new());
- writer.append_ser(bytes).unwrap();
+ writer.append_ser(Into::<ByteBuf>::into(literal)).unwrap();
Review Comment:
> The PR looks good to me overall, but I'm slightly concerned about the use
of Into::<ByteBuf>::into(literal). Will our users have to write code in this
manner? Or does it occur internally?
One choice is to impl `impl From<Literal> for Vec<u8>` instead of `impl
From<Literal> for ByteBuf` and then we can convert to ByteBuf by
`ByteBuf::from(literal)`
Another choice may be:
```
let bytes: BytesBuf = literal.into();
writer.append_ser(bytes)
```
Actually in the case where the type is BytesBuf explicitlly, we don't need `
Into::<ByteBuf>::into(literal)`.🤔
> when I provide a impl From<Literal> for Vec<u8>.
This way looks good to me.
--
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]