fix: Implement Substrait consumer support for like_match, like_imatch, and negated variants #18929
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Rationale for this change
Currently, DataFusion fails to consume Substrait plans that utilize
like_match,like_imatch, or their negated variants (like_not_match,like_not_imatch). This results in a panic withDataFusion error: This feature is not implemented: Unsupported function name: "like_match"during round-trip planning.This PR implements the missing mapping logic in the Substrait consumer to correctly translate these function names into DataFusion
Expr::Likeexpressions.What changes are included in this PR?
BuiltinExprBuilderinscalar_function.rsto recognize:like_match(LIKE)like_imatch(ILIKE)like_not_match(NOT LIKE)like_not_imatch(NOT ILIKE)build_like_exprhelper to accept anegatedboolean flag (previously hardcoded tofalse).test_like_match_conversionto verify the correct conversion of these functions and their arguments.Are these changes tested?
Yes. I added a new unit test
test_like_match_conversionindatafusion/substrait/src/logical_plan/consumer/expr/scalar_function.rs.This test explicitly constructs Substrait plans for
like_matchandlike_not_matchand asserts that they are consumed into correct DataFusionExpr::Likevariants with the appropriatenegatedandcase_insensitiveflags.Note: Verification was done via unit test rather than the standard
sqllogictestsuite becausepredicates.sltwas experiencing unrelated environment-specific failures locally.Are there any user-facing changes?