xueyumusic commented on issue #6445: [FLINK-8302] [table] Add SHIFT_LEFT and 
SHIFT_RIGHT
URL: https://github.com/apache/flink/pull/6445#issuecomment-449848378
 
 
   hi, @pnowojski , I compared different kinds of params type with java 
operators(<<, >>, >>>), hive, pg9.6 and mysql. It looks java operators, hive 
and pg9.6 behave the same for these cases(first param negative, second param 
negative etc). So I think aligning with java operators in code gen is 
reasonable.
   For param type, hive uses the way that if first param is 
tinyint/smallint/int then return value is int and if first param is 
bigint(long) then return value is bigint(long). Thanks @twalthr @pnowojski 
   
     | java | hive | pg9.6 | mysql
   -- | -- | -- | -- | --
   3<<-1 | -2147483648 | -2147483648 | -2147483648 | 0
   4<<-1 | 0 | 0 | 0 | 0
   5<<-1 | -2147483648 | -2147483648 | -2147483648 | 0
   6<<-1 | 0 | 0 | 0 | 0
   7<<-1 | -2147483648 | -2147483648 | -2147483648 | 0
   5<<-2 | 1073741824 | 1073741824 | 1073741824 | 0
   6<<-2 | -2147483648 | -2147483648 | -2147483648 | 0
   5<<-3 | -1610612736 | -1610612736 | -1610612736 | 0
   6<<-3 | -1073741824 | -1073741824 | -1073741824 | 0
   -2<<1 | -4 | -4 | -4 | 1.84E+19
   -5<<2 | -20 | -20 | -20 | 1.84E+19
   -6<<-1 | 0 | 0 | 0 | 0
   -7<<-1 | -2147483648 | -2147483648 | -2147483648 | 0
   32>>-1 | 0 | 0 | 0 | 0
   4>>-1 | 0 | 0 | 0 | 0
   5>>-1 | 0 | 0 | 0 | 0
   -2>>1 | -1 | -1 | -1 | 9.22E+18
   -32>>1 | -16 | -16 | -16 | 9.22E+18
   -5>>2 | -2 | -2 | -2 | 4.61E+18
   -64>>-1 | -1 | -1 | -1 | 0
   -7>>-1 | -1 | -1 | -1 | 0
   -2>>>1 | 2147483647 | 2147483647 |   |  
   -32>>>1 | 2147483632 | 2147483632 |   |  
   -4>>>2 | 1073741823 | 1073741823 |   |  
   -5>>>2 | 1073741822 | 1073741822 |   |  
   -64>>>-1 | 1 | 1 |   |  
   -7>>>-1 | 1 | 1 |   |  
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to