Anthrino commented on code in PR #3369:
URL: https://github.com/apache/calcite/pull/3369#discussion_r1310628458


##########
testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java:
##########
@@ -4568,6 +4568,25 @@ private static void checkIf(SqlOperatorFixture f) {
     f.checkNull("regexp_contains(cast(null as varchar), cast(null as 
varchar))");
   }
 
+  @Test void testRegexpExtractFunc() {
+    final SqlOperatorFixture f =
+        
fixture().setFor(SqlLibraryOperators.REGEXP_EXTRACT).withLibrary(SqlLibrary.BIG_QUERY);
+
+    f.checkString("regexp_extract('abc def ghi', 'def')", "def", "VARCHAR NOT 
NULL");
+    f.checkString("regexp_extract('abcadcaecghi', 'a.c', 1, 3)", "aec", 
"VARCHAR NOT NULL");
+    f.checkString("regexp_extract('abcadcaecghi', 'abc(a.c)')", "adc", 
"VARCHAR NOT NULL");
+    f.checkString("regexp_extract('55as56664as422', '\\d{3}')", "566", 
"VARCHAR NOT NULL");
+
+    f.checkNull("regexp_extract('abc def ghi', 'asd')");
+    f.checkNull("regexp_extract('abc def ghi', cast(null as varchar))");

Review Comment:
   Added additional cases to cover the optional arguments, appreciate the 
feedback!



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to