apache / apache/datafusion

Add additional regexp functions

Open
#11,946 13 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
9.3k
Forks
2.4k
Avg merge
3d 7h
Merged PRs (30d)
344

Description

### Is your feature request related to a problem or challenge?

I would like to see the following regexp functions implemented. These exist in some, but not all, versions of PostgreSQL.

- [ ] [regexp_count()](https://pgpedia.info/r/regexp_count.html)
- [ ] [regexp_instr()](https://pgpedia.info/r/regexp_instr.html)
- [ ] [regexp_matches()](https://pgpedia.info/r/regexp_matches.html)
- [ ] [regexp_split_to_array()](https://pgpedia.info/r/regexp_split_to_array.html)
- [ ] [regexp_split_to_table()](https://pgpedia.info/r/regexp_split_to_table.html)
- [ ] [regexp_substr()](https://pgpedia.info/r/regexp_substr.html)

### Describe the solution you'd like

Implement these functions.

### Describe alternatives you've considered

These operations *can* be performed using the existing functions, so I am currently unblocked for my immediate use case but having these functions built in would be convenient.

### Additional context

We currently have the following regexp functions implemented. The source is in `datafusion/functions/src/regex/mod.rs`

[regexp_like()](https://pgpedia.info/r/regexp_like.html)
[regexp_match()](https://pgpedia.info/r/regexp_match.html)
[regexp_replace()](https://pgpedia.info/r/regexp_replace.html)

Contributor guide

Open the contributing guide

Research direction

Start in datafusion/functions/src/regex/mod.rs and compare the existing regexp_like(), regexp_match(), and regexp_replace() implementations with the linked PostgreSQL references. Implement regexp_count(), regexp_instr(), regexp_matches(), regexp_split_to_array(), regexp_split_to_table(), and regexp_substr(); done means all six requested functions are available with the referenced PostgreSQL behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, rust
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.