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

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

yanghua commented on issue #6432: [FLINK-9970] [table] Add ASCII/CHR function 
for table/sql API
URL: https://github.com/apache/flink/pull/6432#issuecomment-416127815
 
 
   @fhueske I fix this issue by replacing : 
   
   ```
   composite <~ "." ~ ASC ~ opt("()") ^^ { e => Asc(e) }
   ```
   to
   ```
   composite <~ "." ~ ("""(?i)^asc$""").r ~ opt("()") ^^ { e => Asc(e) }
   ```
   
   My test cases and SortStringExpressionTest can be tested successfully.
   
   When I test the function name starting with desc (`"f0.descbb()"`), the same 
exception is reported:
   
   ```
   org.apache.flink.table.api.ExpressionParserException: Could not parse 
expression at column 8: string matching regex `(?i)\Qas\E' expected but `b' 
found
   f0.descbb()
          ^
   
        at 
org.apache.flink.table.expressions.ExpressionParser$.throwError(ExpressionParser.scala:549)
        at 
org.apache.flink.table.expressions.ExpressionParser$.parseExpression(ExpressionParser.scala:542)
        at 
org.apache.flink.table.expressions.utils.ExpressionTestBase.addTableApiTestExpr(ExpressionTestBase.scala:255)
        at 
org.apache.flink.table.expressions.utils.ExpressionTestBase.testTableApi(ExpressionTestBase.scala:275)
        at 
org.apache.flink.table.expressions.ScalarFunctionsTest.testAscii(ScalarFunctionsTest.scala:549)
   ```
   
   In theory, the scalar function names added later have the same possibility 
of prefixes. I think we should use an exact match mode for suffix.
   
   cc @twalthr @walterddr 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Add ASCII/CHR function for table/sql API
> ----------------------------------------
>
>                 Key: FLINK-9970
>                 URL: https://issues.apache.org/jira/browse/FLINK-9970
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Table API &amp; SQL
>            Reporter: vinoyang
>            Assignee: vinoyang
>            Priority: Minor
>              Labels: pull-request-available
>
> for ASCII function : 
> refer to : 
> [https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_ascii]
> for CHR function : 
> This function convert ASCII code to a character,
> refer to : [https://doc.ispirer.com/sqlways/Output/SQLWays-1-071.html]
> Considering "CHAR" always is a keyword in many database, so we use "CHR" 
> keyword.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to