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_r225367094
##########
File path:
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/runtime/functions/ScalarFunctions.scala
##########
@@ -252,6 +252,17 @@ object ScalarFunctions {
regexp_extract(str, regex, 0)
}
+ /**
+ * Returns a numeric value of the leftmost character of the string str.
+ */
+ def ascii(str: String): Integer = {
+ if (str == null || str.equals("")) {
+ 0
Review comment:
hi @xccui , [ASCII code '0' means
NULL](http://ee.hawaii.edu/~tep/EE160/Book/chap4/subsection2.1.1.1.html):
```
The last example in Table 4.3, '0', is called the NULL character, whose
ASCII value is zero. Once again, this is NOT the same character as the
printable digit character, '0', whose ASCII value is 48.
```
----------------------------------------------------------------
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