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


##########
core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java:
##########
@@ -929,6 +929,29 @@ public static String charFromUtf8(int n) {
     return String.valueOf(Character.toChars(n));
   }
 
+  /**
+   * SQL CODE_POINTS_TO_BYTES function.
+   */
+  public static @Nullable ByteString codePointsToBytes(List codePoints) {

Review Comment:
   @herunkang2018 Thanks for your advice. Calcite often use 
`SqlTypeFamily.INTEGER`(which is collection of `INT_TYPES` in `SqlTypeName`) as 
a integer operand checker instead of `SqlTypeName.INTEGER`. This can easily be 
confusing. So `ARRAY_OF_INTEGER` means an array whose component could be 
`TINYINT, SMALLINT, INTEGER or BIGINT`.
   Back to your comment, array component could be any of the `INT_TYPES`, 
including `BIGINT`(Correspond Long in java). The reason I allow the `BIGINT` 
component to pass this checker is because if `BIGINT` component is invaild 
input type, `code_points_to_byte(array[cast(1 as bigint)])` will fail during 
operand type checking, this does not meet expectations. And  if I execute 
`select code_points_to_bytes(array[2147483648])` in BigQuery, BigQuery will 
throw a exception :`Input arguments of CODE_POINTS_TO_BYTES out of range: 
2147483648` rather than input type error(Actully BigQuery see all integers as 
int64).



-- 
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