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]


With regards,
Apache Git Services

Reply via email to