Dysprosium0626 commented on code in PR #261:
URL: https://github.com/apache/iceberg-rust/pull/261#discussion_r1535803356


##########
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:
   Actually I use `Result<Option<Type>>` because in Java implementation there 
is precondition check which will trigger Exception.
   ```java
   Preconditions.checkArgument(
               !field.type().isNestedType(),
               "Cannot explicitly project List or Map types, %s:%s of type %s 
was selected",
               field.fieldId(),
               field.name(),
               field.type());
   ```
   I want to do the same thing in Rust but now I think maybe `panic!` is better 
like
   ```rust
   panic!(
           "Cannot explicitly project List or Map types, {}:{} of type {} was 
selected",
           field.field_id(),
           field.name(),
           field.type()
   );
   ```
   Any suggestions?



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to