lorenarosati opened a new pull request, #16984:
URL: https://github.com/apache/datafusion/pull/16984
## Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases. You can
link an issue to this PR using the GitHub syntax. For example `Closes #123`
indicates that this PR will close issue #123.
-->
- Closes #16949.
## Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly in
the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your
changes and offer better suggestions for fixes.
-->
We've identified Substrait functions that do not have implementations in
DataFusion, but can be represented with existing expressions.
- DataFusion does not understand the Substrait and_not:bool_bool function,
but and_not can be represented with the existing Expr::BinaryExpr -> a AND
NOT(b)
- There's a similar issue for the function xor:bool_bool
- DataFusion does not understand the Substrait between:any_any_any function,
but it can be represented with the existing expression Expr::Between -> expr
BETWEEN low AND high
## What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is
sometimes worth providing a summary of the individual changes in this PR.
-->
- Support for the Substrait functions and_not, xor, and between in the
consumer's built-in expression builder
- and_not and xor are implemented as binary expressions
- between is implemented as a between expression
No changes are needed on the producer side, because the producer can already
recognize and handle these built-in expressions. Note that, similar to other
functions built with the expression builder as well as functions recognized as
operators, a roundtrip direct comparison of the plan strings would fail for
these functions.
## Are these changes tested?
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example, are
they covered by existing tests)?
-->
Yes, tests have been added to verify the correct plan structure.
Furthermore, a new test file was introduced to verify the semantics of the
functions implemented with binary operators (and_not and xor). I think it's
important to verify the semantics, however, I didn't see other tests that
verified actual query results (which is why I created a new test file), so I'm
open to feedback on if this should be removed / modified!
## Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be
updated before approving the PR.
-->
Substrait functions and_not, xor, and between can be included in plans
consumed by DataFusion, and their usage will not result in errors.
<!--
If there are any breaking changes to public APIs, please add the `api
change` label.
-->
--
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]