[ 
https://issues.apache.org/jira/browse/CALCITE-7109?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

krooswu updated CALCITE-7109:
-----------------------------
    Description: 
*Proposal: Add support for {{<<}} (bitwise left shift) operator*
 * Extend parser to recognize {{{}<<{}}}.

 * Add {{SqlBinaryOperator}} in {{{}SqlStdOperatorTable{}}}.

 * Support in {{{}SqlToRelConverter{}}}, {{{}RexBuilder{}}}.

 * Add type inference and validation for {{INTEGER}} and {{BIGINT}} (promote 
mixed types).

 * Negative shift count throws exception.

 * Overflow shift silently truncates bits.

 * Follow standard SQL null handling.

 * Tests to cover parsing, validation, execution ({{{}SqlOperatorTest{}}}, 
{{{}SqlValidatorTest{}}}, {{{}RexImpTableTest{}}}, {{{}RexProgramTest{}}}) and 
integration tests in {{{}operator.iq{}}}.

 * No initial support for {{VARBINARY}} (future extension).

This aligns behavior with PostgreSQL and MySQL. SQL Server’s negative shift 
handling is not adopted.

  was:
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{}}}.

 


> 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
>
> *Proposal: Add support for {{<<}} (bitwise left shift) operator*
>  * Extend parser to recognize {{{}<<{}}}.
>  * Add {{SqlBinaryOperator}} in {{{}SqlStdOperatorTable{}}}.
>  * Support in {{{}SqlToRelConverter{}}}, {{{}RexBuilder{}}}.
>  * Add type inference and validation for {{INTEGER}} and {{BIGINT}} (promote 
> mixed types).
>  * Negative shift count throws exception.
>  * Overflow shift silently truncates bits.
>  * Follow standard SQL null handling.
>  * Tests to cover parsing, validation, execution ({{{}SqlOperatorTest{}}}, 
> {{{}SqlValidatorTest{}}}, {{{}RexImpTableTest{}}}, {{{}RexProgramTest{}}}) 
> and integration tests in {{{}operator.iq{}}}.
>  * No initial support for {{VARBINARY}} (future extension).
> This aligns behavior with PostgreSQL and MySQL. SQL Server’s negative shift 
> handling is not adopted.



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

Reply via email to