yanghua commented on a change in pull request #6432: [FLINK-9970] [table] Add 
ASCII/CHR function for table/sql API
URL: https://github.com/apache/flink/pull/6432#discussion_r206741741
 
 

 ##########
 File path: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/calls/FunctionGenerator.scala
 ##########
 @@ -146,12 +146,25 @@ object FunctionGenerator {
     STRING_TYPE_INFO,
     BuiltInMethod.OVERLAY.method)
 
+  addSqlFunctionMethod(
+    ASCII,
+    Seq(STRING_TYPE_INFO),
+    STRING_TYPE_INFO,
 
 Review comment:
   @suez1224 thanks for your reminder. You are right, In the scenario you 
mentioned, it throws an exception. I found that we don't need to check if the 
input of the function is null. It seems that the Flink framework has been 
processed by default. All the input is null and will return null (man can not 
interfere). Then we only need to deal with "", in this case, the ASCII code is 
0. So, I directly changed the return value of this method to the Int type. 
   
   cc @hequn8128 : 
   
   It seems that we don't need to consider the case where the input is null. 
Once the input of the function is null, this function will not be called at 
all. I debugged it through the test class. It looks like this, you can confirm 
it.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to