Dwrite commented on PR #4543:
URL: https://github.com/apache/calcite/pull/4543#issuecomment-3299259558

   Thanks @mihaibudiu . Good point. Since we already put the other bitwise 
operators (e.g. ^, <<) in
   `SqlStdOperatorTable`, I think it makes sense to keep `&` there as well for
   consistency. Otherwise the operators would be split across different places,
   which could be confusing for users.
   
   I I have one concern about the current type support of the `&` operator.  
   Right now, the definition in `OperandTypes` only allows either
   - INTEGER & INTEGER  
   - BINARY & BINARY  
   - UNSIGNED_NUMERIC & UNSIGNED_NUMERIC  
   
   This effectively excludes cases like `INTEGER & UNSIGNED_INTEGER`.  
   Do we want to restrict it this way, or should we allow `unsigned` to mix with
   other numeric types as well?
   
   From a usability perspective, most databases (e.g. MySQL) allow bitwise
   operations between signed and unsigned integers, and the result type usually
   follows an "unsigned-preferred" rule.  
   If we want to align with that, we might consider extending the operand type
   definition to accept `NUMERIC & NUMERIC`, with the return type handling the
   unsigned promotion logic.
   
   What do you think?
   


-- 
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