This is an automated email from the ASF dual-hosted git repository.

lincoln pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/master by this push:
     new 8c6f13cead9 [FLINK-36230][pyflink-table] Fix the incorrect calling of 
REGEXP_EXTRACT Python Table API
8c6f13cead9 is described below

commit 8c6f13cead9e982f568c36135a350c45baf90d6c
Author: dylanhz <[email protected]>
AuthorDate: Thu Sep 12 09:14:06 2024 +0800

    [FLINK-36230][pyflink-table] Fix the incorrect calling of REGEXP_EXTRACT 
Python Table API
    
    This closes #25309
---
 flink-python/pyflink/table/expression.py            | 2 +-
 flink-python/pyflink/table/tests/test_expression.py | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/flink-python/pyflink/table/expression.py 
b/flink-python/pyflink/table/expression.py
index ae1923556d9..d53f8bb12fe 100644
--- a/flink-python/pyflink/table/expression.py
+++ b/flink-python/pyflink/table/expression.py
@@ -1286,7 +1286,7 @@ class Expression(Generic[T]):
         group index.
         """
         if extract_index is None:
-            return _ternary_op("regexpExtract")(self, regex)
+            return _binary_op("regexpExtract")(self, regex)
         else:
             return _ternary_op("regexpExtract")(self, regex, extract_index)
 
diff --git a/flink-python/pyflink/table/tests/test_expression.py 
b/flink-python/pyflink/table/tests/test_expression.py
index 178570d3fa4..2ea4bbdffbd 100644
--- a/flink-python/pyflink/table/tests/test_expression.py
+++ b/flink-python/pyflink/table/tests/test_expression.py
@@ -185,6 +185,7 @@ class PyFlinkBatchExpressionTests(PyFlinkTestCase):
         # regexp functions
         self.assertEqual("regexp(a, b)", str(expr1.regexp(expr2)))
         self.assertEqual("REGEXP_COUNT(a, b)", str(expr1.regexp_count(expr2)))
+        self.assertEqual('regexpExtract(a, b)', 
str(expr1.regexp_extract(expr2)))
         self.assertEqual('regexpExtract(a, b, 3)', 
str(expr1.regexp_extract(expr2, 3)))
         self.assertEqual('REGEXP_EXTRACT_ALL(a, b)', 
str(expr1.regexp_extract_all(expr2)))
         self.assertEqual('REGEXP_EXTRACT_ALL(a, b, 3)', 
str(expr1.regexp_extract_all(expr2, 3)))

Reply via email to