mapleFU opened a new issue, #126:
URL: https://github.com/apache/iceberg-cpp/issues/126

   Iceberg [1] and iceberg-rust [2] both have expression system. There are some 
design trade-off:
   
   ## Bind
   
   Both iceberg and iceberg-rust have concept of "bind". I guess this concept 
is from database query compiler. Specifically, it means bind the reference ( we 
name it as "term" later ) from "name" to a iceberg `Schema` with 
`case_sensitive` setting.
   
   In the iceberg java and iceberg-rust's code, the expression itself doesn't 
need to Bind from expr naming to a specific structure.
   
   ## Term
   
   In Java's implementation, `Term` has the derivation below:
   
   ```
   interface Term;
   interface Unbound {
     Bounded Bind(Schema, caseSensitive);
     NamedReference<?> ref();
   }
   class UnboundTerm : Term, Unbound;
   class BoundedTerm : Term;
   
   class NamedReference : UnboundTerm;
   class UnbounedTransform : UnboundTerm;
   class UnbounedExtract : UnboundTerm;
   
   class BoundReference : BoundTerm;
   class BounedTransform : BoundTerm;
   class BounedExtract : BoundTerm;
   ```
   
   The rust also has bind and Transform, but it uses different way to handle 
this:
   
   ```
   type Term = UnboundedTerm;
   ```
   
   Instead, it uses `InclusiveProjection` to convert the `PartitionSpec` to a 
expression, rules may like [3][4]:
   
   1. Create `InclusiveProjection`
   2. Each `Transform` has a `project` method, with project the partition 
expression to the normal expression, and return a `Predicate` ( unbounded 
filter )
   
   ## Reference
   
   In java and rust, `Reference` implements use similiar way:
   1. `Unbounded` has a "name"
   2. `Bounded` is has `(name, accessor, ..)`
   
   The accessor of `Schema` is like "index of vector".
   
   ## Expression
   
   Expression itself doesn't have any bind logic, it just bind all subfields
   
   ## Evaluator
   
   TBD
   
   [1] 
https://github.com/apache/iceberg/tree/e5541de0fd1e850f188ff89cac1417b3ae3500a4/api/src/main/java/org/apache/iceberg/expressions
   [2] 
https://github.com/apache/iceberg-rust/tree/f1e79c0d9c76e90cb4ceb1f2c409ef8d1b68b273/crates/iceberg/src/expr
   [3] 
https://github.com/apache/iceberg-rust/blob/f1e79c0d9c76e90cb4ceb1f2c409ef8d1b68b273/crates/iceberg/src/expr/visitors/inclusive_projection.rs#L85
   [4] 
https://github.com/apache/iceberg-rust/blob/f1e79c0d9c76e90cb4ceb1f2c409ef8d1b68b273/crates/iceberg/src/spec/transform.rs#L471


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