Skip to content

Apache DataFusion SQL Query Engine

ARROW-12186: [Rust][DataFusion] Fix regexp_match test

Mike Seddon3ea7e5d2f5cf
diff --git a/rust/datafusion/tests/sql.rs b/rust/datafusion/tests/sql.rs
index 8c2c35ef6f..5f3bc30b2c 100644
--- a/rust/datafusion/tests/sql.rs
+++ b/rust/datafusion/tests/sql.rs
@@ -2499,6 +2499,17 @@ async fn test_regex_expressions() -> Result<()> {
test_expression!("regexp_replace('foobarbaz', NULL, 'X\\1Y', 'g')", "NULL");
test_expression!("regexp_replace('Thomas', '.[mN]a.', 'M')", "ThM");
test_expression!("regexp_replace(NULL, 'b(..)', 'X\\1Y', 'g')", "NULL");
+ test_expression!("regexp_match('foobarbequebaz', '')", "[]");
+ test_expression!(
+ "regexp_match('foobarbequebaz', '(bar)(beque)')",
+ "[bar, beque]"
+ );
+ test_expression!("regexp_match('foobarbequebaz', '(ba3r)(bequ34e)')", "NULL");
+ test_expression!("regexp_match('aaa-0', '.*-(\\d)')", "[0]");
+ test_expression!("regexp_match('bb-1', '.*-(\\d)')", "[1]");
+ test_expression!("regexp_match('aa', '.*-(\\d)')", "NULL");
+ test_expression!("regexp_match(NULL, '.*-(\\d)')", "NULL");
+ test_expression!("regexp_match('aaa-0', NULL)", "NULL");
Ok(())
}
@@ -2560,17 +2571,6 @@ async fn test_in_list_scalar() -> Result<()> {
test_expression!("'2' IN ('a','b',NULL,1)", "NULL");
test_expression!("'1' NOT IN ('a','b',NULL,1)", "false");
test_expression!("'2' NOT IN ('a','b',NULL,1)", "NULL");
- test_expression!("regexp_match('foobarbequebaz', '')", "[]");
- test_expression!(
- "regexp_match('foobarbequebaz', '(bar)(beque)')",
- "[bar, beque]"
- );
- test_expression!("regexp_match('foobarbequebaz', '(ba3r)(bequ34e)')", "NULL");
- test_expression!("regexp_match('aaa-0', '.*-(\\d)')", "[0]");
- test_expression!("regexp_match('bb-1', '.*-(\\d)')", "[1]");
- test_expression!("regexp_match('aa', '.*-(\\d)')", "NULL");
- test_expression!("regexp_match(NULL, '.*-(\\d)')", "NULL");
- test_expression!("regexp_match('aaa-0', NULL)", "NULL");
Ok(())
}