Github user jodersky commented on a diff in the pull request:
https://github.com/apache/spark/pull/15398#discussion_r83520908
--- Diff:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/RegexpExpressionsSuite.scala
---
@@ -74,6 +107,31 @@ class RegexpExpressionsSuite extends SparkFunSuite with
ExpressionEvalHelper {
checkEvaluation("a\nb" like regEx, true, create_row("a%b"))
checkEvaluation(Literal.create(null, StringType) like regEx, null,
create_row("bc%"))
+
+ checkEvaluation("" like regEx, true, create_row(""))
+ checkEvaluation("a" like regEx, false, create_row(""))
+ checkEvaluation("" like regEx, false, create_row("a"))
+
+ checkEvaluation("""\\\\""" like regEx, true, create_row("""%\\%"""))
+ checkEvaluation("""%%""" like regEx, true, create_row("""%%"""))
+ checkEvaluation("""\__""" like regEx, true, create_row("""\\\__"""))
+ checkEvaluation("""\\\__""" like regEx, false,
create_row("""%\\%\%"""))
+ checkEvaluation("""_\\\%""" like regEx, false, create_row("""%\\"""))
+
+ // scalastyle:off nonascii
+ checkEvaluation("a\u20ACa" like regEx, true, create_row("_\u20AC_"))
+ checkEvaluation("aâ¬a" like regEx, true, create_row("_â¬_"))
+ checkEvaluation("aâ¬a" like regEx, true, create_row("_\u20AC_"))
+ checkEvaluation("a\u20ACa" like regEx, true, create_row("_â¬_"))
+ // scalastyle:on nonascii
+
+ // TODO: should throw an exception?
--- End diff --
> The escape character must be a single character no more than two bytes in
length. It can only appear in the pattern string if it is followed by itself, a
percent sign, or an underscore.
does this mean that PostgreSQL's behaviour is wrong? Should spark throw an
exception in point 2?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]