Commit ec6da64
committed
[Analytics Backend / DataFusion] Append "g" flag in RegexpReplaceAdapter for 3-arg calls
DataFusion's regexp_replace defaults to first-match-only without an explicit
flag; Calcite's REGEXP_REPLACE_3 is already replace-all. PPL relies on the
Calcite contract (every match replaced — used by SIMPLE patterns, regex_replace,
rex mode=sed), so on the DataFusion path the adapter now rewrites every 3-arg
REGEXP_REPLACE_3 to 4-arg REGEXP_REPLACE_PG_4(..., "g") preserving the same
end-user semantics across backends.
Companion change in opensearch-project/sql#5467: the SQL core no longer emits
the 'g' flag itself — that DataFusion-specific concern now lives only here.
Two existing unit tests updated to expect the new always-global behavior
(testAdaptPassesThroughWhenNoQuoteBlock → testAdaptAppendsGlobalFlagFor3Arg,
testAdaptPassesThroughNonLiteralPattern → testAdaptAppendsGlobalFlagForNonLiteralPattern).
The \Q rewrite, $N backreference rewrite, and 4-arg-with-flags pass-through
are unchanged.
Signed-off-by: Kai Huang <ahkcs@amazon.com>1 parent 9c7d359 commit ec6da64
2 files changed
Lines changed: 33 additions & 12 deletions
File tree
- sandbox/plugins/analytics-backend-datafusion/src
- main/java/org/opensearch/be/datafusion
- test/java/org/opensearch/be/datafusion
Lines changed: 17 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| |||
96 | 98 | | |
97 | 99 | | |
98 | 100 | | |
99 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
100 | 108 | | |
101 | 109 | | |
102 | 110 | | |
103 | 111 | | |
104 | 112 | | |
105 | 113 | | |
106 | 114 | | |
107 | | - | |
| 115 | + | |
108 | 116 | | |
109 | 117 | | |
110 | 118 | | |
111 | 119 | | |
112 | 120 | | |
113 | 121 | | |
114 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
115 | 130 | | |
116 | 131 | | |
117 | 132 | | |
| |||
Lines changed: 16 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
168 | | - | |
169 | | - | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
170 | 172 | | |
171 | 173 | | |
172 | 174 | | |
173 | 175 | | |
174 | 176 | | |
175 | | - | |
| 177 | + | |
176 | 178 | | |
177 | | - | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
178 | 183 | | |
179 | 184 | | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
184 | 188 | | |
185 | 189 | | |
186 | 190 | | |
187 | 191 | | |
188 | 192 | | |
189 | | - | |
| 193 | + | |
190 | 194 | | |
191 | | - | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
192 | 198 | | |
193 | 199 | | |
194 | 200 | | |
| |||
0 commit comments