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

jackwangcs commented on FLINK-26939:
------------------------------------

Hi [~lsy] , [~twalthr]  could you assign this ticket to me? I am working on it.

One caveat about `translate(expr, from, to)` is that it will be parsed as a 
TRANSLATE3 SqlCall instead of TRANSLATE in Calcite, see 
https://issues.apache.org/jira/browse/CALCITE-1115. 

!image-2022-05-11-09-51-21-400.png|width=1022,height=305!

In order to work around this, I think we could just define both TRANSLATE and 
TRANSLATE3 Built-in functions but using the same definition and runtime class. 
does it make sense?

 

> Add TRANSLATE supported in SQL & Table API
> ------------------------------------------
>
>                 Key: FLINK-26939
>                 URL: https://issues.apache.org/jira/browse/FLINK-26939
>             Project: Flink
>          Issue Type: Sub-task
>            Reporter: dalongliu
>            Priority: Critical
>         Attachments: image-2022-05-11-09-51-21-400.png
>
>
> Syntax:
> translate(expr, from, to)
>  
> Arguments:
>  * {{{}expr{}}}: A STRING expression.
>  * {{{}from{}}}: A STRING expression consisting of a set of characters to be 
> replaced.
>  * {{{}to{}}}: A STRING expression consisting of a matching set of characters 
> to replace {{{}from{}}}.
> Return: 
> A STRING
>  
> Examples:
> {code:java}
> > SELECT translate('AaBbCc', 'abc', '123');
>  A1B2C3
> > SELECT translate('AaBbCc', 'abc', '1');
>  A1BC
> > SELECT translate('AaBbCc', 'abc', '');
>  ABC {code}
> See more
>  * [Hive|https://cwiki.apache.org/confluence/display/hive/languagemanual+udf]
>  * 
> [Databricks|https://docs.databricks.com/sql/language-manual/functions/translate.html]



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to