-
Notifications
You must be signed in to change notification settings - Fork 113
feat: new expression builders #1829
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
For binary expressions, we now have eq, not_eq, lt, lt_eq, gt, gt_eq, and, or For literals we have lit For Identity we have ident
| /// result.into_bool().unwrap().boolean_buffer(), | ||
| /// BoolArray::from_iter(vec![false, false, true]).boolean_buffer(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing I noticed while writing these doctests is that we don't have a nicer generic way of building a BooleanBuffer. You need to build a full BoolArray and then access its arrow booleanbuffer.
I added a macro so you could do something like bools![true, false, true] but that still forces you to bring in an arrow_buffer dep. We should probably use and return our own booleanbuffer type to make this more ergonomic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we need to make our own BooleanBuffer type... relatedly, #1774
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can construct BooleanBuffer directly from Iter<bool>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea but then you need to add a dep on arrow_buffer where there wasn't previously, and sadly rust doesn't let you enable a dep only for doctests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh actually I'm wrong, apparently doc tests use dev-dependencies
|
An alternative that is a bit closer to what Arrow does is to implement the binary operators as method chains. |
|
I think we should do this instead of chaining. Chaining is nice but not sure correct if our expressions are not an enum |
|
I don't know what you mean @robert3005 ? Can we do chaining too? It's better for discoverability. |
|
We can do chaining but it's unclear how chaining works in general for arbitrarily extensible traits. Datafusion does chaining for Expressions not PhysicalExpression |
|
Can |
|
Yes, you can do this. You still need to have many traits like that since not all expression will be defined in one place. |
For binary expressions, we now have eq, not_eq, lt, lt_eq, gt, gt_eq, and, or (see vortex-expr/src/binary.rs). Add example usage doctests for all
For literals we have lit
For Identity we have ident