You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (Jira)" <ji...@apache.org> on 2023/06/07 23:29:00 UTC
[jira] [Comment Edited] (CALCITE-5766) Implement SAFE_NEGATE function (enabled for BigQuery)
[ https://issues.apache.org/jira/browse/CALCITE-5766?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17730310#comment-17730310 ]
Julian Hyde edited comment on CALCITE-5766 at 6/7/23 11:28 PM:
---------------------------------------------------------------
Oops, I see this is {{SAFE_NEGATE}} not {{SAFE_MULTIPLY}}.
In {{SAFE_MULTIPLY}}, note that every case where {{SAFE_NEGATE\(x)}} returns NULL is also a case where {{SAFE_MULTIPLY(x, -1)}} and {{SAFE_MULTIPLY(-1, x)}} should return null.
was (Author: julianhyde):
Oops, I see this is {{SAFE_NEGATE}} not {{SAFE_MULTIPLY}}.
In {{SAFE_MULTIPLY}}, note that every case where {{SAFE_NEGATE(x)}} returns NULL is also a case where {{SAFE_MULTIPLY(x, -1)}} and {{SAFE_MULTIPLY(-1, x)}} should return null.
> Implement SAFE_NEGATE function (enabled for BigQuery)
> -----------------------------------------------------
>
> Key: CALCITE-5766
> URL: https://issues.apache.org/jira/browse/CALCITE-5766
> Project: Calcite
> Issue Type: Sub-task
> Reporter: Tanner Clary
> Assignee: Tanner Clary
> Priority: Major
> Labels: pull-request-available
>
> Add support for SAFE_NEGATE in BigQuery.
> SAFE_NEGATE: Equivalent to the unary minus operator (-), but returns NULL if overflow occurs.
> Example #1: {{SELECT SAFE_NEGATE(3)}} would return {{-3}}.
> Example #2: {{SELECT SAFE_NEGATE(-9223372036854775808)}} would return {{NULL}} because of overflow.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)