macroguo-ghy commented on code in PR #3389:
URL: https://github.com/apache/calcite/pull/3389#discussion_r1308734521


##########
core/src/main/java/org/apache/calcite/sql/type/OperandTypes.java:
##########
@@ -510,6 +510,38 @@ public static SqlOperandTypeChecker variadic(
         }
       };
 
+  public static final SqlSingleOperandTypeChecker ARRAY_OF_INTEGER =

Review Comment:
   IMO, if the argument types of the function is incorrect (such as `array 
['abc ']`), Calcite should throw an exception as early as possible. Using 
`ARRAY_OF_INTEGER` can throw exceptions during validation rather than at 
runtime, avoiding unnecessary conversions and executions. 
   And during function execution, all elements are of type Number, so I change 
`if (codePoint instanceof Number)` to `assert codePoint instanceof Number`.



##########
site/_docs/reference.md:
##########
@@ -2685,6 +2685,7 @@ BigQuery's type system uses confusingly different names 
for types and functions:
 | b | CEIL(value)                                    | Similar to standard 
`CEIL(value)` except if *value* is an integer type, the return type is a double
 | m s | CHAR(integer)                                | Returns the character 
whose ASCII code is *integer* % 256, or null if *integer* < 0
 | b o p | CHR(integer)                               | Returns the character 
whose UTF-8 code is *integer*
+| b | CODE_POINTS_TO_BYTES(integers)                 | Converts *integers*, an 
array of integers between 0 and 255 inclusive, throws error if any element is 
out of range

Review Comment:
   fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@calcite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to