jayzhan211 commented on issue #5830:
URL: https://github.com/apache/datafusion/issues/5830#issuecomment-5649823176
I'm thinking we could have something like this in `datafusion-common`, and
`simplify_predicates` forces `Domain → Expr` 🤔
```rs
pub enum Endpoint {
Unbounded,
Open(ScalarValue), // exclusive
Closed(ScalarValue), // inclusive
}
pub struct Range { lower: Endpoint, upper: Endpoint }
pub struct Domain {
data_type: DataType,
ranges: Vec<Range>, // sorted, disjoint, non-adjacent, all non-empty
nulls: bool,
}
impl Domain {
fn all(dt: &DataType) -> Self; // ranges: [(-∞,∞)], nulls:
true
fn none(dt: &DataType) -> Self;
fn null(dt: &DataType) -> Self; // ranges: [], nulls: true
fn from_range(dt, Range, nulls: bool) -> Result<Self>;
fn from_values(dt, impl IntoIterator<Item = ScalarValue>) ->
Result<Self>; // IN lists
fn union(&self, &Self) -> Result<Self>;
fn intersect(&self, &Self) -> Result<Self>;
fn contains(&self, &ScalarValue) -> bool;
fn is_empty(&self) -> bool; // the refutation test
fn is_all(&self) -> bool;
}
```
--
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]