nielspardon opened a new pull request, #5073:
URL: https://github.com/apache/calcite/pull/5073

   ## Jira Link
   
   [CALCITE-7109](https://issues.apache.org/jira/browse/CALCITE-7109)
   
   ## Changes Proposed
   
   Mirrors the left-shift work in CALCITE-7109 to close a gap in the umbrella 
issue CALCITE-5087. 
   
   Adds:
   
     * `>>` (SqlStdOperatorTable.BIT_RIGHT_SHIFT), a signed/arithmetic right 
shift (Java `>>`), symmetric to `<<` (precedence 32, left-assoc, 
ReturnTypes.ARG0_NULLABLE, InferTypes.FIRST_KNOWN, and the same INTEGER / 
BINARY / UNSIGNED_NUMERIC operand families).
     * `RIGHTSHIFT(x, n)` scalar function, mirroring `LEFTSHIFT`.
     * SqlFunctions.rightShift(...) runtime overloads (int, long, byte[], 
ByteString, and the joou unsigned types), plus BuiltInMethod.RIGHT_SHIFT and 
the RexImpTable registrations for both operator and function.
   
   Unlike `<<`, a greedy `>>` token cannot be added: the lexer would also match 
the two `>` that close nested angle-bracket types (e.g. MAP<INT, MAP<INT, 
INT>>), breaking type parsing. `>>` is therefore recognized in expression 
context as two adjacent `>` tokens via LOOKAHEAD(2) in BinaryRowOperator, 
leaving type parsing unchanged. Because there is no dedicated token, the SQL 
advisor advertises `>` rather than `>>`, so SqlAdvisorTest is not modified.
   
   Scope is limited to `>>` (arithmetic). The logical/fill-zero `>>>` 
(RIGHT_SHIFT_FILL_ZERO) remains a possible follow-up.
   
   The code in this PR was generated with the help of AI.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to