tanclary commented on code in PR #3571:
URL: https://github.com/apache/calcite/pull/3571#discussion_r1442031507


##########
site/_docs/reference.md:
##########
@@ -2806,14 +2806,14 @@ BigQuery's type system uses confusingly different names 
for types and functions:
 | h s | string1 NOT RLIKE string2                    | Whether *string1* does 
not match regex pattern *string2* (similar to `NOT LIKE`, but uses Java regex)
 | b o | RPAD(string, length[, pattern ])             | Returns a string or 
bytes value that consists of *string* appended to *length* with *pattern*
 | b o | RTRIM(string)                                | Returns *string* with 
all blanks removed from the end
-| b | SAFE_ADD(numeric1, numeric2)                   | Returns *numeric1* + 
*numeric2*, or NULL on overflow
+| b | SAFE_ADD(numeric1, numeric2)                   | Returns *numeric1* + 
*numeric2*, or NULL on overflow.  Only supports BIGINT, DOUBLE, or DECIMAL 
arguments

Review Comment:
   In BigQuery, all integer "types" are aliases for INT64. 
   
   
https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#integer_types
   
   I think the docs could be improved but like @chucheng92 said, your 
suggestion implies other integer types are not supported. This is not the case.
   
   `SELECT SAFE_ADD(CAST(32767 as SMALLINT), CAST(2 AS SMALLINT))` in BigQuery 
does not overflow. Your comments imply that it would. 
   
   If we are implementing a BigQuery function, my main concern is that we 
maintain parity with BigQuery. 
   
   The easiest way of doing this is coercing all other integer types to 
`BIGINT`. Whether "easiest" = "best" might be another discussion.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to