liurenjie1024 commented on code in PR #261:
URL: https://github.com/apache/iceberg-rust/pull/261#discussion_r1536788615
##########
crates/iceberg/src/spec/schema.rs:
##########
@@ -642,6 +644,204 @@ impl SchemaVisitor for IndexByName {
}
}
+struct PruneColumn {
+ selected: HashSet<i32>,
+ select_full_types: bool,
+}
+
+/// Visit a schema and returns only the fields selected by id set
+pub fn prune_columns(
+ schema: &Schema,
+ selected: HashSet<i32>,
+ select_full_types: bool,
+) -> Result<Option<Type>> {
Review Comment:
> I want to do the same thing in Rust but now I think maybe panic! is better
like
We should avoid panic as much as possible since it cause an application
crash. Also the error maybe caused by user input, which is an error and we
should not panic.
In java's implementation, it tries to return empty struct or schema:
1.
https://github.com/apache/iceberg/blob/684f7a767c2c216a402b60b73d2d55ef605921a0/api/src/main/java/org/apache/iceberg/types/TypeUtil.java#L74
2.
https://github.com/apache/iceberg/blob/684f7a767c2c216a402b60b73d2d55ef605921a0/api/src/main/java/org/apache/iceberg/types/TypeUtil.java#L74
--
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]