-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-38173][SQL] Quoted column cannot be recognized correctly when quotedRegexColumnNa… #35476
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
please change the title and enable GA. Also you can paste hive code in the PR desc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can make it more like a scala code.
to use
pattern.find()
or
pattern.forall()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
AngersZhuuuu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
ping @cloud-fan |
|
Can one of the admins verify this patch? |
private def canApplyRegex(ctx: ParserRuleContext): Boolean = withOrigin(ctx) {
var parent = ctx.getParent
if(!isRegex(ctx.getText)) return false
while (parent != null) {
if (parent.isInstanceOf[NamedExpressionContext]) return true
parent = parent.getParent
}
return false
}The isRegex function only needs to be called once, If it is not regular, it can return false directly. |
Thanks. Updated |
|
better use |
|
thanks, merging to master! |
…when quotedRegexColumnNames is true ### What changes were proposed in this pull request? backporting #35476 to 3.2 ### Why are the changes needed? bug fixing in 3.2 ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? new UT Closes #39473 from huaxingao/3.2. Authored-by: huaxingao <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
…when quotedRegexColumnNames is true ### What changes were proposed in this pull request? backporting apache#35476 to 3.2 ### Why are the changes needed? bug fixing in 3.2 ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? new UT Closes apache#39473 from huaxingao/3.2. Authored-by: huaxingao <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
What changes were proposed in this pull request?
bug fix
Why are the changes needed?
When spark.sql.parser.quotedRegexColumnNames=true
The above query will throw an exception
It works fine in hive, because hive treats a pattern with all alphabets/digits and "_" as a normal string
In this pr, we add the
isRegexmethod to check whether the pattern is a regex expressionDoes this PR introduce any user-facing change?
NO
How was this patch tested?
UT