-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-30759][SQL] Initialize cache for foldable patterns in StringRegexExpression #27502
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,9 +41,10 @@ trait StringRegexExpression extends Expression | |
|
|
||
| override def dataType: DataType = BooleanType | ||
|
|
||
| // try cache the pattern for Literal | ||
| // try cache foldable pattern | ||
| private lazy val cache: Pattern = pattern match { | ||
| case Literal(value: String, StringType) => compile(value) | ||
| case p: Expression if p.foldable => | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will consider
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The changes don't impact on behavior in any case, so, they can be considered only as an optimization. |
||
| compile(p.eval().asInstanceOf[UTF8String].toString) | ||
| case _ => null | ||
| } | ||
|
|
||
|
|
||
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.
@MaxGekk . This is SPARK-9242 (Spark 1.5.0) https://github.com/apache/spark/pull/8321/files#diff-39298b470865a4cbc67398a4ea11e767R41.
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.
Reynold just moved the code. Actually it exists since 1.0.0: af3746c#diff-d788f93e29b4d25cdd7d60328587678bR42