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

Jerin John edited comment on CALCITE-5979 at 10/3/23 6:28 PM:
--------------------------------------------------------------

Hi [~julianhyde],

Just wanted to follow up on this above comment on testing with char literals in 
BQ, I ran some SqlParser tests to check if double backslashes are supported 
using BQ_DOUBLE in Calcite and the queries were parsed fine.

the double backslashes shouldn't cause any query exceptions but the underlying 
SqlFunction implementation needs to convert it into capturing group refs 
(${index} instead of \\\{index}) which is where a new conformance based 
operator would be needed to preprocess this string arg, so we need to decide if 
thats the path to take or if its a feature we can skip for now.

Edit: Just saw your comment above and will create a PR based on those 
suggestions, thanks!


was (Author: JIRAUSER301314):
Hi [~julianhyde],

Just wanted to follow up on this above comment on testing with char literals in 
BQ, I ran some SqlParser tests to check if double backslashes are supported 
using BQ_DOUBLE in Calcite and the queries were parsed fine.

the double backslashes shouldn't cause any query exceptions but the underlying 
SqlFunction implementation needs to convert it into capturing group refs 
(${index} instead of \\\\{index}) which is where a new conformance based 
operator would be needed to preprocess this string arg, so we need to decide if 
thats the path to take or if its a feature we can skip for now.

Edit: Just saw your comment above and will create a PR based on those 
suggestions, thanks!

> 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