lorenarosati opened a new pull request, #16950: URL: https://github.com/apache/datafusion/pull/16950
## 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 have implementations in DataFusion, but are not mapped to those functions because their names are slightly different. For example, DataFusion does not understand the Substrait is_nan function, because DataFusion's name for the same function is isnan, and the Substrait consumer and producer work off of direct name mappings. ## 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. --> - New mapping created in the consumer to map Substrait names to DataFusion names - Added new name mappings to the existing mapping of DataFusion names to Substrait names; in the producer, the register_function() calls the implementation of register_function() in Extensions, and this registers function names with function anchors (so this is where mappings are added). This PR adds mappings for the Substrait functions sign, is_nan, and logb, but the same process can be done to add mappings for more 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)? --> - Test added on the consumer side that consumes a scalar function and checks if an error occurs - Roundtrip test added that follows the structure of existing roundtrip tests (testing both the producer and consumer) but includes a check that the producer produced Substrait with the appropriate Substrait name. - There's an [existing test](https://github.com/apache/datafusion/blob/2a7f64a85e3d98c51c106607a425d73d2b839e82/datafusion/substrait/tests/cases/roundtrip_logical_plan.rs#L415) that would test this roundtrip. Without this PR, this test would create an intermediate Substrait plan with the wrong function name (when it calls to_substrait_plan()) but the test would still pass because it would convert back to the right DataFusion name. This test makes testing this change more explicit, but feel free to let me know if this test is unnecessary / should be removed / any other suggestion! The roundtrip test tests is_nan function mappings, and the test on the consumer side tests sign function mappings. It seems repetitive to run the same test for all the newly added mappings, but I'm open to feedback on whether this should be added! ## Are there any user-facing changes? <!-- If there are user-facing changes then we may require documentation to be updated before approving the PR. --> The Substrait consumer will be able to consume functions that previously resulted in an unsupported function error, and the producer will produce Substrait plans with the correct function names. <!-- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org