[ 
https://issues.apache.org/jira/browse/CALCITE-5735?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17736295#comment-17736295
 ] 

Julian Hyde commented on CALCITE-5735:
--------------------------------------

Please use Guava {{LongMath.checkedMultiply(long, long)}}. (See 
[javadoc|https://guava.dev/releases/20.0/api/docs/com/google/common/math/LongMath.html#checkedMultiply-long-long-],
 
[code|https://github.com/google/guava/blob/bf792538a7a31fe757861ec6e09bd3ddf8c8191e/guava/src/com/google/common/math/LongMath.java#L576].)

Consider using other {{LongMath}} functions for other {{SAFE_xxx}} SQL 
functions.

> Implement SAFE_MULTIPLY function (enabled for BigQuery)
> -------------------------------------------------------
>
>                 Key: CALCITE-5735
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5735
>             Project: Calcite
>          Issue Type: Sub-task
>            Reporter: Tanner Clary
>            Assignee: Tanner Clary
>            Priority: Major
>              Labels: pull-request-available
>
> Add support for SAFE_MULTIPLY in BigQuery.
> SAFE_MULTIPLY: Equivalent to the multiplication operator '*', but returns 
> NULL if overflow occurs.
> Example #1: {{SELECT SAFE_MULTIPLY(3, 4)}} would return {{12}}.
> Example #2: {{SELECT SAFE_MULTIPLY(2^63, 2)}} would return {{NULL}} because 
> of overflow.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to