apache / apache/datafusion

Is pre-compile pattern string in regexp_match operation

Open
#11,146 3 comments 0 reactions 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 noticed below code:
https://github.com/apache/datafusion/blob/6a4a280e3cf70fe5f1a1cfe7c2de13e4c39f89bb/datafusion/physical-expr/src/expressions/binary.rs#L537-L564
This looks like every time record_batch is evaluated, it will execute the compiled pattern string and use the compiled results to match arrow-array

### Describe the solution you'd like

when building binary physical expr , we can pre-compile pattern string if op is regex_match

### Describe alternatives you've considered

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start in datafusion/physical-expr/src/expressions/binary.rs at lines 537-564 and trace how the binary physical expression handles regexp_match during record-batch evaluation. Confirm where the pattern is compiled, then verify that construction-time compilation preserves matching behavior while avoiding repeated compilation for each batch.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
databases
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.