From 9ec1b961c5201a413039489a62fdf0d37f732f18 Mon Sep 17 00:00:00 2001 From: stantheman0128 Date: Thu, 13 Aug 2026 03:48:01 +0800 Subject: [PATCH 1/2] docs: document regular expression function arguments regexp_instr documents its parameters in an Args section, the other four regexp functions document none. Adds Args to regexp_like, regexp_match, regexp_replace and regexp_count, reusing the wording regexp_instr already uses for the parameters they share. --- python/datafusion/functions/__init__.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/python/datafusion/functions/__init__.py b/python/datafusion/functions/__init__.py index 291957490..b3a7cda9a 100644 --- a/python/datafusion/functions/__init__.py +++ b/python/datafusion/functions/__init__.py @@ -1761,6 +1761,11 @@ def regexp_like( Tests a string using a regular expression returning true if at least one match, false otherwise. + Args: + string: Data to test against the regular expression. + regex: Regular expression to search for. + flags: Optional regular expression flags to control regex behavior. + Examples: >>> ctx = dfn.SessionContext() >>> df = ctx.from_pydict({"a": ["hello123"]}) @@ -1797,6 +1802,11 @@ def regexp_match( Returns an array with each element containing the leftmost-first match of the corresponding index in ``regex`` to string in ``string``. + Args: + string: Data to match against the regular expression. + regex: Regular expression to search for. + flags: Optional regular expression flags to control regex behavior. + Examples: >>> ctx = dfn.SessionContext() >>> df = ctx.from_pydict({"a": ["hello 42 world"]}) @@ -1839,6 +1849,13 @@ def regexp_replace( Supported flags with the addition of 'g' can be found at + Args: + string: Data to search for the regular expression match. + pattern: Regular expression to search for. + replacement: Text substituted for each match. + flags: Optional regular expression flags to control regex behavior. Add + ``g`` to replace every match rather than only the first. + Examples: >>> ctx = dfn.SessionContext() >>> df = ctx.from_pydict({"a": ["hello 42"]}) @@ -1885,6 +1902,12 @@ def regexp_count( Optional start position (the first position is 1) to search for the regular expression. + Args: + string: Data to search for the regular expression match. + pattern: Regular expression to search for. + start: Optional position to start the search (the first position is 1). + flags: Optional regular expression flags to control regex behavior. + Examples: >>> ctx = dfn.SessionContext() >>> df = ctx.from_pydict({"a": ["abcabc"]}) From 593e8589ab2fc7a0d321da2c0c137005d4b81334 Mon Sep 17 00:00:00 2001 From: Po-Han Shih Date: Fri, 28 Aug 2026 16:19:11 +0800 Subject: [PATCH 2/2] Drop Optional from the argument descriptions Per review: the signature already says these are optional, and unlike the docstring itself that free text cannot be tested for staying accurate. --- python/datafusion/functions/__init__.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/python/datafusion/functions/__init__.py b/python/datafusion/functions/__init__.py index b3a7cda9a..e3502ce3a 100644 --- a/python/datafusion/functions/__init__.py +++ b/python/datafusion/functions/__init__.py @@ -1764,7 +1764,7 @@ def regexp_like( Args: string: Data to test against the regular expression. regex: Regular expression to search for. - flags: Optional regular expression flags to control regex behavior. + flags: Flags to control regex behavior. Examples: >>> ctx = dfn.SessionContext() @@ -1805,7 +1805,7 @@ def regexp_match( Args: string: Data to match against the regular expression. regex: Regular expression to search for. - flags: Optional regular expression flags to control regex behavior. + flags: Flags to control regex behavior. Examples: >>> ctx = dfn.SessionContext() @@ -1853,8 +1853,8 @@ def regexp_replace( string: Data to search for the regular expression match. pattern: Regular expression to search for. replacement: Text substituted for each match. - flags: Optional regular expression flags to control regex behavior. Add - ``g`` to replace every match rather than only the first. + flags: Flags to control regex behavior. Add ``g`` to replace every + match rather than only the first. Examples: >>> ctx = dfn.SessionContext() @@ -1905,8 +1905,8 @@ def regexp_count( Args: string: Data to search for the regular expression match. pattern: Regular expression to search for. - start: Optional position to start the search (the first position is 1). - flags: Optional regular expression flags to control regex behavior. + start: Position to start the search (the first position is 1). + flags: Flags to control regex behavior. Examples: >>> ctx = dfn.SessionContext()