[ 
https://issues.apache.org/jira/browse/CALCITE-5979?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17763233#comment-17763233
 ] 

Jerin John edited comment on CALCITE-5979 at 9/8/23 7:44 PM:
-------------------------------------------------------------

Totally agree Tanner, we can think about skipping support for this feature and 
document as a known bug but not sure of the future impact.
Wrt enabling this feature for other dialects, with some limited testing on 
MySQL I can see that the results are altered for scenarios where {{"\ (\d)"}} s 
are present in the string along with a capturing group in regex pattern, since 
this starts replacing it with the capturing group where originally it might not 
be intended, or might throw errors for indices of missing groups (these are 
very exceptional scenarios when someone is specifically coding the string with 
and pattern to be this way, but still an edge case).

[~julianhyde] makes sense, based on these implementations we have encountered 
only two cases where BQ supports additional syntax, one with this above 
capturing groups and the other with some invalid regex cases as documented in 
[CALCITE-5910|https://issues.apache.org/jira/browse/CALCITE-5910]


was (Author: JIRAUSER301314):
Totally agree Tanner, we can think about skipping support for this feature and 
document as a known bug but not sure of the future impact.
Wrt enabling this feature for other dialects, with some limited testing on 
MySQL I can see that the results are altered for scenarios where {{"\ (\d)"}} s 
are present in the string along with a capturing group in regex pattern, since 
this starts replacing it with the capturing group where originally it might not 
be intended, or might throw errors for indices of missing groups (these are 
very exceptional scenarios when someone is specifically coding the string with 
and pattern to be this way, but still an edge case).

> Add REGEXP_REPLACE function (enabled in BigQuery library)
> ---------------------------------------------------------
>
>                 Key: CALCITE-5979
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5979
>             Project: Calcite
>          Issue Type: Task
>            Reporter: Jerin John
>            Assignee: Jerin John
>            Priority: Major
>              Labels: pull-request-available
>
> Add support for [REGEXP_REPLACE 
> |https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions#regexp_replace]
>  function from BigQuery.
> *{{REGEXP_REPLACE(value, regexp, replacement)}}*
> Returns a STRING where all substrings of {{value}} that match regular 
> expression {{regexp}} are replaced with {{{}replacement{}}}.
> backslashed-escaped digits (\1 to \9) can be used within the {{replacement}} 
> argument to insert text matching the corresponding parenthesized group in the 
> {{regexp}} pattern.
> Example (added one space between \ \ to override md formatting):
> {{SELECT REGEXP_REPLACE("abc'", "b(.)", "X\ \1") as result;}}
> |result|
> |aXc|



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to