amogh-jahagirdar commented on code in PR #132:
URL: https://github.com/apache/iceberg-rust/pull/132#discussion_r1435850488


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

Review Comment:
   Nit: I think we could either remove the "used in Apache Iceberg" since it's 
somewhat self explanatory since it's in the project itself, or we could just 
remove the comment entirely.



##########
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:
   I agree that aggregation pushdown optimizations can be very powerful but I'd 
argue that we don't add the expression until we actually use those. It makes 
maintaining public APIs easier until we have a need. 
   
   That was the same model followed in the Java expression case (the 
count/max/min expression was only added when Spark aggregation pushdown was 
worked on). Let me know what you think @liurenjie1024 ?



##########
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::*;

Review Comment:
   Could we avoid import * and rather explicitly import what we need?



##########
crates/iceberg/src/expr/unbound.rs:
##########
@@ -0,0 +1,45 @@
+// 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 unbound expressions.
+
+use crate::error::Result;
+use crate::expr::bound::Bound;
+use crate::expr::Operator;
+use crate::spec::{Literal, Schema};
+
+/// Unbound expressions.
+pub enum Unbound {
+    /// Constants, such as 1, 'a', true, false, null.
+    Literal(Literal),

Review Comment:
   Not sure I follow, what does it mean to have an unbound literal? We wouldn't 
be binding a literal to anything anyways right?



##########
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:
   Should we follow a model closer to what's done in the Java library? Even 
though literals are technically the leaf they don't extend Expression.



##########
crates/iceberg/src/expr/unbound.rs:
##########
@@ -0,0 +1,45 @@
+// 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 unbound expressions.
+
+use crate::error::Result;
+use crate::expr::bound::Bound;
+use crate::expr::Operator;
+use crate::spec::{Literal, Schema};
+
+/// Unbound expressions.
+pub enum Unbound {
+    /// Constants, such as 1, 'a', true, false, null.
+    Literal(Literal),
+    /// References to fields, such as `col` or `tbl.col`.
+    Reference(String),
+    /// Expressions
+    Expr {
+        /// Operator for this expression, such as `AND` or `OR`.
+        operator: Operator,
+        /// Arguments of this express.

Review Comment:
   Nit: I think we could just use the full word here `expression`



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