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

ASF GitHub Bot commented on FLINK-3498:
---------------------------------------

Github user twalthr commented on a diff in the pull request:

    https://github.com/apache/flink/pull/1747#discussion_r54601133
  
    --- Diff: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/api/table/codegen/calls/ScalarFunctions.scala
 ---
    @@ -49,6 +49,11 @@ object ScalarFunctions {
         STRING_TYPE_INFO,
         BuiltInMethod.SUBSTRING.method)
     
    +  addSqlFunctionTrim(
    --- End diff --
    
    `TRIM` is a special case because the runtime function takes other 
parameters than the user can provide. In SQL `TRIM` has its own syntax 
`TRIM(BOTH '.' FROM str)`. `BOTH` is translated into  a SQL Symbol but the 
runtime function uses two boolean arguments. That's why we cannot pass the 
arguments directly to runtime function and need a special `TrimCallGenerator`. 
The SQL Symbol is translated to an integer value (the same same value can also 
come from Expression API) and is then translated to the two `boolean` 
parameters.


> Implement TRIM, SUBSTRING as reference design for Table API
> -----------------------------------------------------------
>
>                 Key: FLINK-3498
>                 URL: https://issues.apache.org/jira/browse/FLINK-3498
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Table API
>            Reporter: Timo Walther
>            Assignee: Timo Walther
>
> As described in FLINK-3497 TRIM and SUBSTRING are the first scalar functions 
> implemented in Calcite and used in Table API.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to