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 2025/07/25 16:42:00 UTC

[jira] [Commented] (CALCITE-7109) Add support for << operator in Calcite

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

Julian Hyde commented on CALCITE-7109:
--------------------------------------

To make it easier for us to triage, can you please add links to jira cases (open or closed) for other bit operators. 

Do any databases support this operation via a function, as opposed to a bitwise operator? It might be wise to add the function too, because functions can be enabled/disabled without changing the parser. 

Please add a couple of SQL examples in your summary. Mention any tricky corner cases like overflow. How does overflow work in a DECIMAL type? 

> Add support for << operator in Calcite
> --------------------------------------
>
>                 Key: CALCITE-7109
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7109
>             Project: Calcite
>          Issue Type: New Feature
>            Reporter: krooswu
>            Assignee: krooswu
>            Priority: Major
>              Labels: pull-request-available
>
> Calcite currently does not support the {{<<}} (bitwise left shift) operator in SQL expressions. This operator is commonly used in various SQL dialects (e.g., PostgreSQL, SQL Server, MySQL) for efficient manipulation of integer bit patterns.
> This issue proposes to add parser, validation, and Rex-level support for the {{<<}} operator, consistent with existing bitwise operations like {{{}&{}}}, {{{}|{}}}, and {{{}^{}}}.
> *Scope:*
>  * Extend the SQL parser to recognize the {{<<}} operator.
>  * Implement a corresponding {{{}SqlBinaryOperator{}}}.
>  * Add support in {{SqlToRelConverter}} and {{{}RexBuilder{}}}.
>  * Add type inference and validation logic (e.g., restrict to integer types).
>  * Write tests covering SQL parsing, validation, and execution via {{{}RexExecutor{}}}.
>  



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