Skip to content

Commit

Permalink
Update comment
Browse files Browse the repository at this point in the history
  • Loading branch information
beliefer committed Dec 5, 2019
1 parent 64e49b7 commit 9feb25d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ abstract class StringRegexExpression extends BinaryExpression
When SQL config 'spark.sql.parser.escapedStringLiterals' is enabled, it fallbacks
to Spark 1.6 behavior regarding string literal parsing. For example, if the config is
enabled, the pattern to match "\abc" should be "\abc".
* escape - an optional string added since Spark 3.0. The default escape character is the '\'.
* escape - an string added since Spark 3.0. The default escape character is the '\'.
If an escape character precedes a special symbol or another escape character, the
following character is matched literally. It is invalid to escape any other character.
""",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ object LikeSimplification extends Rule[LogicalPlan] {
private val equalTo = "([^_%]*)".r

def apply(plan: LogicalPlan): LogicalPlan = plan transformAllExpressions {
case Like(input, Literal(pattern, StringType), opt) =>
case Like(input, Literal(pattern, StringType), escapeChar) =>
if (pattern == null) {
// If pattern is null, return null value directly, since "col like null" == null.
Literal(null, BooleanType)
Expand All @@ -503,7 +503,7 @@ object LikeSimplification extends Rule[LogicalPlan] {
Contains(input, Literal(infix))
case equalTo(str) =>
EqualTo(input, Literal(str))
case _ => Like(input, Literal.create(pattern, StringType), opt)
case _ => Like(input, Literal.create(pattern, StringType), escapeChar)
}
}
}
Expand Down

0 comments on commit 9feb25d

Please sign in to comment.