Details
Description
In the case of foldable patterns, the cache in StringRegexExpression should be evaluated once but in fact it is compiled every time. Here is the example:
SELECT '%SystemDrive%\Users\John' _FUNC_ '%SystemDrive%\\Users.*';
// try cache the pattern for Literal private lazy val cache: Pattern = pattern match { case Literal(value: String, StringType) => compile(value) case _ => null }
The attached screenshot shows that foldable expression doesn't fall to the first case.