fix(regexp_replace): validate IsString on unwrapped union values#6898
Open
SAY-5 wants to merge 1 commit intobrimdata:mainfrom
Open
fix(regexp_replace): validate IsString on unwrapped union values#6898SAY-5 wants to merge 1 commit intobrimdata:mainfrom
SAY-5 wants to merge 1 commit intobrimdata:mainfrom
Conversation
…ort unions Closes brimdata#6892. regexp_replace() unwraps each arg with .Under() to handle union types, but the IsString() check was performed on the original wrapper instead of the unwrapped values. For inputs typed as union(string|null), the wrapper carries the union type (IsString()==false) even when the underlying value is a string, so the function rejected them with 'string arg required'. Validate IsString() on sVal/reVal/newVal directly. The vector runtime already unwraps before evaluation, which is why it worked there.
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.
Closes #6892.
regexp_replace()already unwraps each arg with.Under()to handleunion types, but the
IsString()check was performed on the originalwrapper rather than the unwrapped value. For inputs typed as
union(string|null), the wrapper carries the union type(
IsString()==false) even when the underlying value is a string, sothe call was rejected with
regexp_replace: string arg required.This patch validates
IsString()onsVal/reVal/newValdirectly,so the function accepts string values whether they arrive as plain
strings or as the string member of a union. The vector runtime
unwraps before evaluation, which is why the same query worked under
-vam.Repro (from #6892)
Before:
After: