@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 

[ Full content available at: https://github.com/apache/flink/pull/6432 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to