OSDir


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

=?gb18030?b?u9i4tKO6IGNhbGNpdGUgc3VwcG9ydCBiaXQgb3Bl?==?gb18030?b?cmF0aW9u?=


In MySQL:
  
the supported builtin bit functions and operators are: BIT_COUNT, &, |, ^, ~, << and >> 
 
the supported builtin bit aggregations are: BIT_AND, BIT_OR and BIT_XOR
  
For example:
 MySQL(localhost:3306) > select 1 ^ 2; +-------+ | 1 ^ 2 | +-------+ |     3 | +-------+ 1 row in set (0.01 sec) MySQL(localhost:3306) > select bit_or(a), b from t group by b; +-----------+------+ | bit_or(a) | b    | +-----------+------+ |         3 |    1 | |         3 |    2 | +-----------+------+ 2 rows in set (0.00 sec)  
See the following links for more details:
  
https://dev.mysql.com/doc/refman/5.7/en/bit-functions.html
 
https://dev.mysql.com/doc/refman/5.7/en/group-by-functions.html
  ​











------------------ 原始邮件 ------------------
发件人: "Julian Hyde"<jhyde@xxxxxxxxxx>; 
发送时间: 2018年6月10日(星期天) 中午12:31
收件人: "dev"<dev@xxxxxxxxxxxxxxxxxx>; 
主题: Re: calcite support bit operation



PS Can you see what support for bit operations is in other databases? It would be quite straightforward to add new functions, less easy to add “&” or “|” or “~”.

> On Jun 9, 2018, at 6:47 PM, Julian Hyde <jhyde@xxxxxxxxxx> wrote:
> 
> BIt operations are not standard SQL.
> 
> Are there any databases that support them? (I’m guessing MySQL, which at one point seemed to have a mission to convert SQL into C, even down to using int instead of boolean.)
> 
> We could perhaps add support for bit operations, but I would not like to add an ‘&’ operator. It would be too disruptive to the parser. Maybe it could go into Babel.
> 
> Julian
> 
>> On Jun 9, 2018, at 5:38 PM, 18390992640 <m18390992640_2@xxxxxxx> wrote:
>> 
>> Hello EveryOne !
>>     I have seed calcite SqlKind.java source code, find that it hasn't bit operation.  so I want to ask why calcite don't support bit operation. for example, follow Query statement, it not support.
>>     select col_a, col_b from table_1 where (col_a & col_b) > 10.
>>       if I want to   extend calcite to supoort bit operation, how difficulty may be?
>>        who knwo this, please give me a help.  thanks very mush!
>