You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Dmitry Sysolyatin (Jira)" <ji...@apache.org> on 2026/01/15 06:49:00 UTC
[jira] [Comment Edited] (CALCITE-7360) The meaning of negation for unsigned numbers is not defined
[ https://issues.apache.org/jira/browse/CALCITE-7360?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18052000#comment-18052000 ]
Dmitry Sysolyatin edited comment on CALCITE-7360 at 1/15/26 6:48 AM:
---------------------------------------------------------------------
Although I like the idea of having an explicit cast to signed type, we cannot reject such expressions because some dialects allow them. For example, MySQL supports this syntax
{code:java}
SELECT -CAST(1 AS UNSIGNED INTEGER)
-1
{code}
was (Author: dmsysolyatin):
Although I like the idea of having an explicit cast to SIGNED, we cannot reject such expressions because some dialects allow them. For example, MySQL supports this syntax
{code:java}
SELECT -CAST(1 AS UNSIGNED INTEGER)
-1
{code}
> The meaning of negation for unsigned numbers is not defined
> -----------------------------------------------------------
>
> Key: CALCITE-7360
> URL: https://issues.apache.org/jira/browse/CALCITE-7360
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.41.0
> Reporter: Mihai Budiu
> Priority: Minor
> Labels: pull-request-available
>
> Some time ago unsigned integer types were introduced in Calcite.
> They allow all arithmetic operations as signed types.
> However, the meaning of negation is not defined. Using negation in a quidem test causes an exception, since the implementation is incorrect.
> Questions:
> * Should negation be allowed at all?
> * Should it coerce the value to a larger integer type?
> * Or should it work as in C?
--
This message was sent by Atlassian Jira
(v8.20.10#820010)