Fokko commented on code in PR #132:
URL: https://github.com/apache/iceberg-rust/pull/132#discussion_r1434045494


##########
crates/iceberg/src/expr/bound.rs:
##########
@@ -0,0 +1,41 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! This module defines bound expressions.
+
+use crate::expr::Operator;
+use crate::spec::{Literal, NestedFieldRef};
+
+/// Bound expression.
+pub enum Bound {
+    /// Constants such as 1, 'a', true, false, null.
+    Literal(Literal),
+    /// Reference to some field in schema
+    Reference {
+        /// Original name
+        name: String,

Review Comment:
   Why keep the name here when we have the reference to the field?
   
   The reason I'm asking is that the same field can have different names if you 
have renamed a column along the way.



##########
crates/iceberg/src/expr/mod.rs:
##########
@@ -0,0 +1,49 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! This module contains expressions used in apache iceberg.
+
+mod bound;
+pub use bound::*;
+mod unbound;
+pub use unbound::*;
+
+/// Operators used in expressions.
+#[allow(missing_docs)]
+pub enum Operator {
+    IsNull,
+    NotNull,
+    IsNan,
+    NotNan,
+    LessThan,
+    LessThanOrEq,
+    GreaterThan,
+    GreaterThanOrEq,
+    Eq,
+    NotEq,
+    In,
+    NotIn,
+    Not,
+    And,
+    Or,
+    StartsWith,
+    NotStartsWith,
+    Count,
+    CountStar,
+    Max,
+    Min,

Review Comment:
   These are aggregations, do we want them in here as well? Mostly because they 
don't evaluate as a boolean expression on its own. 



##########
crates/iceberg/src/expr/bound.rs:
##########
@@ -0,0 +1,41 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! This module defines bound expressions.
+
+use crate::expr::Operator;
+use crate::spec::{Literal, NestedFieldRef};
+
+/// Bound expression.
+pub enum Bound {

Review Comment:
   The only thing I'm unsure about is having a Literal as a bound. It feels 
counterintuitive to me since you cannot bind a literal.



##########
crates/iceberg/src/expr/bound.rs:
##########
@@ -0,0 +1,41 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! This module defines bound expressions.
+
+use crate::expr::Operator;
+use crate::spec::{Literal, NestedFieldRef};
+
+/// Bound expression.
+pub enum Bound {
+    /// Constants such as 1, 'a', true, false, null.
+    Literal(Literal),
+    /// Reference to some field in schema
+    Reference {
+        /// Original name
+        name: String,
+        /// Nested field found in schema.
+        field: NestedFieldRef,
+    },
+    /// Expressions
+    Expr {
+        /// Operator for this expression, such as `AND` or `OR`.

Review Comment:
   This can be any operator, right?
   ```suggestion
           /// Operator for this expression, such as `And`, `Or`, `IsNull`, 
`Eq`, `LessThan` etc.
   ```



##########
crates/iceberg/src/expr/mod.rs:
##########
@@ -0,0 +1,49 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! This module contains expressions used in apache iceberg.
+
+mod bound;
+pub use bound::*;
+mod unbound;
+pub use unbound::*;
+
+/// Operators used in expressions.
+#[allow(missing_docs)]
+pub enum Operator {

Review Comment:
   Is an Enum appropriate here? In Python we carry for example the invert on 
the Operators itself: 
https://github.com/apache/iceberg-python/blob/main/pyiceberg/expressions/__init__.py#L491-L498
   
   ```
   Not(IsNan('a')) -> IsNotNan('a')
   ```



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