liurenjie1024 opened a new issue, #159: URL: https://github.com/apache/iceberg-rust/issues/159
In our discussion in #77, we decoupled type info from struct values. I'm also facing some challenge when implementing #153. In short, the `PrimitiveLiteral` is kind of weird: 1. Sometimes it's self contained, for simple types such as `int`, `date`, `string`. 2. Sometimes it's not self contained, for example `decimal`. Since we have decided to decouple type info from actual values, I think we should further do it to primitive types. But sometimes it would be quite useful so associated type info with actuals, for example when we want to allow user to construct an expression `a < 3.25`, where `3.25` is a decimal. I would suggest to do following refactoring: 1. Further simplify `PrimitiveLiteral` to have only several physical variants: bool, i32, i64, i128, float, double, bytes, utf8. It's mainly used as in memory data structures for things like manifest, data files, etc. 2. Add a new type `Datum` which is self contained primitive value, it can be implemented as following: ``` pub enum Datum { bool(bool), int(i32), ... datetime(DateTime<Utc>), decimal(Decimal), } ``` `Datum` is mainly used in user facing apis, such as expression construction. ## Alternatives 1. Should we implement `PrimitiveLiteral` just as `Vec<u8>`? It's possible, but I don't think it's a good idea. By using physical types, we can avoid a lot unsafe codes, and make things easier to maintain. -- 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