Skip to content

feat(dremio): support 4-argument REGEXP_SPLIT - #8148

Open
rusackas wants to merge 1 commit into
tobymao:mainfrom
rusackas:dremio-regexp-split
Open

feat(dremio): support 4-argument REGEXP_SPLIT#8148
rusackas wants to merge 1 commit into
tobymao:mainfrom
rusackas:dremio-regexp-split

Conversation

@rusackas

@rusackas rusackas commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Found another goofy thing we've been working around in Superset, trying to fix upstream where it belongs.

Dremio's REGEXP_SPLIT(string, pattern, mode, limit) takes a required mode argument (e.g. 'ALL') positioned ahead of limit, which is a shape the shared exp.RegexpSplit didn't have a slot for.

This adds mode to RegexpSplit.arg_types, appended after limit so existing 2/3-arg positional callers via from_arg_list (Doris SPLIT_BY_STRING, ClickHouse SPLITBYREGEXP, DuckDB STR_SPLIT_REGEX/STRING_SPLIT_REGEX, Hive SPLIT) keep mapping their existing args unchanged.

Dremio's own parser/generator build and render the args in the dialect's real order (this, expression, mode, limit) via an explicit builder rather than relying on the shared positional from_arg_list.

Found this while rebasing Superset's local Dremio dialect (which previously shadowed sqlglot's native one, see apache/superset#43099) onto sqlglot's DremioParser/DremioGenerator. Superset had a local-only REGEXP_SPLIT override to fill this gap.

Tests:

  • tests/dialects/test_dremio.py::test_regexp_split (new)
  • Full tests/dialects/test_dremio.py suite: 23 passed
  • Cross-checked other RegexpSplit consumers for regressions: test_doris.py, test_clickhouse.py, test_duckdb.py, test_hive.py — 104 passed
  • Full test suite: 1213 passed, 2 skipped

Dremio's REGEXP_SPLIT(string, pattern, mode, limit) takes a required
"mode" argument (e.g. 'ALL') ahead of "limit", which the shared
exp.RegexpSplit didn't have a slot for. Add "mode" to arg_types
(appended after "limit" so existing 2/3-arg positional callers via
from_arg_list keep mapping unchanged) and wire Dremio's parser/
generator to build/render it in the dialect's real argument order.
arg_types = {"this": True, "expression": True, "limit": False}
# "mode" is Dremio-specific (e.g. 'ALL'), appended after "limit" so existing
# 2/3-arg positional callers (from_arg_list) keep mapping "limit" unchanged
arg_types = {"this": True, "expression": True, "limit": False, "mode": False}

@rusackas rusackas Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it's too weird to put a Dremio-specific thing here... open to advice from the real experts around here :D

Can't say I see/know a better way around this, but I'm happy to nix the explanatory comment if that's too vendor specific/noisy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant