File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -1582,11 +1582,18 @@ def regexp_count(
15821582 >>> result.collect_column("c")[0].as_py()
15831583 1
15841584 """
1585+ pattern = _to_raw_literal_expr (pattern )
15851586 flags = _to_raw_literal_expr (flags ) if flags is not None else None
15861587 start = _to_raw_literal_expr (start ) if start is not None else None
1587- return Expr (
1588- f .regexp_count (string .expr , _to_raw_literal_expr (pattern ), start , flags )
1589- )
1588+
1589+ # If Python callers pass only flags, supply the default start=1.
1590+ # because Datafusion accepts:
1591+ # regexp_count(string, pattern, start)
1592+ # regexp_count(string, pattern, start, flags)
1593+ if start is None and flags is not None :
1594+ start = _to_raw_literal_expr (1 )
1595+
1596+ return Expr (f .regexp_count (string .expr , pattern , start , flags ))
15901597
15911598
15921599def regexp_instr (
You can’t perform that action at this time.
0 commit comments