Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

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

case p: Expression if p.foldable =>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will consider 'a' + 'b' from now. I prefer to consider SPARK-30759 as a performance improvement and merge to master only.

Copy link
Member Author

Choose a reason for hiding this comment

The 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
}

Expand Down