beliefer commented on a change in pull request #27507:
URL: https://github.com/apache/spark/pull/27507#discussion_r463070305
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/StringFunctionsSuite.scala
##########
@@ -154,8 +154,38 @@ class StringFunctionsSuite extends QueryTest with
SharedSparkSession {
Row("300", "100") :: Row("400", "100") :: Row("400-400", "100") :: Nil)
}
+ test("string regex_extract_all") {
+ val df = Seq(
+ ("100-200,300-400", "(\\d+)-(\\d+)"),
+ ("101-201,301-401", "(\\d+)-(\\d+)"),
+ ("102-202,302-402", "(\\d+)")).toDF("a", "b")
+
+ checkAnswer(
+ df.select(
+ regexp_extract_all($"a", "(\\d+)-(\\d+)", 1),
+ regexp_extract_all($"a", "(\\d+)-(\\d+)", 2)),
+ Row(Seq("100", "300"), Seq("200", "400")) ::
+ Row(Seq("101", "301"), Seq("201", "401")) ::
+ Row(Seq("102", "302"), Seq("202", "402")) :: Nil)
+
+ // for testing the mutable state of the expression in code gen.
+ // This is a hack way to enable the codegen, thus the codegen is enable by
default,
+ // it will still use the interpretProjection if projection followed by a
LocalRelation,
+ // hence we add a filter operator.
+ // See the optimizer rule `ConvertToLocalRelation`
Review comment:
OK
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]