Skip to content

Commit

Permalink
Change java string literal to SQL shell string.
Browse files Browse the repository at this point in the history
  • Loading branch information
viirya committed May 11, 2017
1 parent d8cd670 commit 8ecb2ea
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ abstract class StringRegexExpression extends BinaryExpression
any other character.
Since Spark 2.0, string literals are unescaped in our SQL parser. For example, in order
to match a Tab character "\t", the pattern should be "\\t".
to match "\abc", the pattern should be "\\abc".
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 a Tab character should be "\t".
enabled, the pattern to match "\abc" should be "\abc".
Examples:
> SELECT '%SystemDrive%\Users\John' _FUNC_ '\%SystemDrive\%\\Users%'
Expand Down Expand Up @@ -158,11 +158,11 @@ case class Like(left: Expression, right: Expression) extends StringRegexExpressi
regexp - a string expression. The pattern string should be a Java regular expression.
Since Spark 2.0, string literals (including regex patterns) are unescaped in our SQL parser.
For example, if to match "abc\td", a regular expression for `regexp` can be "^abc\\\\td$".
For example, if to match "\abc", a regular expression for `regexp` can be "^\\abc$".
There is a SQL config 'spark.sql.parser.escapedStringLiterals' that can be used to fallback
to the Spark 1.6 behavior regarding string literal parsing. For example, if the config is
enabled, the `regexp` that can match "abc\td" is "^abc\\t$".
enabled, the `regexp` that can match "\abc" is "^\abc$".
Examples:
When spark.sql.parser.escapedStringLiterals is disabled (default).
Expand Down

0 comments on commit 8ecb2ea

Please sign in to comment.