Fix REGEXP_EXTRACT to return NULL instead of empty string on no match#31
Open
ggjh-159 wants to merge 1 commit into
Open
Fix REGEXP_EXTRACT to return NULL instead of empty string on no match#31ggjh-159 wants to merge 1 commit into
ggjh-159 wants to merge 1 commit into
Conversation
3537b5b to
89dfc96
Compare
89dfc96 to
ded03e3
Compare
Author
|
@lgbo-ustc @zhanglistar @KevinyhZou Would you mind reviewing this PR? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What changes are proposed in this pull request?
Override
regexp_extractto return NULL on no match instead of empty string. The Spark version passesemptyNoMatch=true, returning empty string on no match. Flink'sREGEXP_EXTRACTexpects NULL on no match. This matters forIS NOT NULLfiltering which breaks when empty string is returned instead of NULL.How was this patch tested?
Tested by running Nexmark Q21 on Gluten-Flink with 10000 events. The query uses
WHERE REGEXP_EXTRACT(url, '(&|^)channel_id=([^&]*)', 2) IS NOT NULL. Previously rows withoutchannel_idin URL were incorrectly included (REGEXP_EXTRACT returned""making IS NOT NULL always true). After this fix, those rows are correctly filtered out.Note: A companion fix in gluten-flink is also needed. See gluten-pr-12267.
related issue: gluten-issue-12266.