You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by 18390992640 <m1...@163.com> on 2018/06/10 00:38:45 UTC

calcite support bit operation

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!

回复: calcite support bit operation

Posted by 张建 <15...@qq.com>.
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"<jh...@apache.org>; 
发送时间: 2018年6月10日(星期天) 中午12:31
收件人: "dev"<de...@calcite.apache.org>; 
主题: 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 <jh...@apache.org> 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 <m1...@163.com> 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!
>

Re: calcite support bit operation

Posted by Julian Hyde <jh...@apache.org>.
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 <jh...@apache.org> 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 <m1...@163.com> 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!
> 


Re: calcite support bit operation

Posted by Julian Hyde <jh...@apache.org>.
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 <m1...@163.com> 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!