liurenjie1024 commented on code in PR #231:
URL: https://github.com/apache/iceberg-rust/pull/231#discussion_r1519136619


##########
crates/iceberg/src/expr/predicate.rs:
##########
@@ -55,6 +60,24 @@ impl<T, const N: usize> LogicalExpression<T, N> {
     }
 }
 
+impl<T: Bind, const N: usize> Bind for LogicalExpression<T, N>
+where
+    T::Bound: Sized,
+{
+    type Bound = LogicalExpression<T::Bound, N>;
+
+    fn bind(self, schema: SchemaRef, case_sensitive: bool) -> 
Result<Self::Bound> {
+        let mut outputs: [Option<Box<T::Bound>>; N] = array_init(|_| None);
+        for (i, input) in self.inputs.into_iter().enumerate() {
+            outputs[i] = Some(Box::new(input.bind(schema.clone(), 
case_sensitive)?));
+        }
+
+        // It's safe to use `unwrap` here since they are all `Some`.

Review Comment:
   My first version uses `MaybeUninit`, but it involves `unsafe` codes. I think 
we should avoid `unsafe` as much as possible.



-- 
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]

Reply via email to