File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -1582,11 +1582,19 @@ 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+ # Accepted call forms in Datafusion include:
1591+ # two arguments: string + pattern
1592+ # three arguments: string + pattern + start
1593+ # four arguments: string + pattern + start + flags
1594+ if start is None and flags is not None :
1595+ start = _to_raw_literal_expr (1 )
1596+
1597+ return Expr (f .regexp_count (string .expr , pattern , start , flags ))
15901598
15911599
15921600def regexp_instr (
You can’t perform that action at this time.
0 commit comments