[ 
https://issues.apache.org/jira/browse/CALCITE-1927?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16114633#comment-16114633
 ] 

Julian Hyde commented on CALCITE-1927:
--------------------------------------

The BIT type is obsolete in the SQL standard, so I don't feel strongly about 
this. Anyone using Avatica to access Calcite or Hbase (via Phoenix) will either 
be using BOOLEAN, BINARY or VARBINARY. I can't imagine a case where people 
would want, say, 11 bits but weren't prepared to use a data structure that gave 
them 16.

Neither does Calcite support bit strings, e.g. {{b'101'}}.

In [SQL 
Server|https://docs.microsoft.com/en-us/sql/t-sql/data-types/bit-transact-sql] 
it seems to be limited to 1 bit (0, 1 or null), so it has the same information 
content as BOOLEAN.

[MySQL|https://dev.mysql.com/doc/refman/5.7/en/bit-type.html] allows {{BIT(m)}} 
with m up to 64. Each bit can have a value of 0 or 1.

> Mapping for Types.BIT: boolean or BitSet?
> -----------------------------------------
>
>                 Key: CALCITE-1927
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1927
>             Project: Calcite
>          Issue Type: Bug
>          Components: avatica
>    Affects Versions: 1.13.0
>            Reporter: Vladimir Sitnikov
>              Labels: pgjdbc, postgresql
>
> Currently Avatica implements `Types.BIT` as `Boolean` (see 
> https://github.com/apache/calcite-avatica/blob/4db1fb9c66db8ccebc9e96ce678154ec69c557f0/core/src/main/java/org/apache/calcite/avatica/AvaticaSite.java#L227-L230
>  )
> Certain databases (e.g. PostgreSQL) have {{bit\(n)}} and {{varbit\(n)}} data 
> types that are "bit strings" (see 
> https://www.postgresql.org/docs/9.6/static/datatype-bit.html )
> If both used together, {{getObject}} just blows when trying to convert thing 
> like {{'01101'}} to a boolean.
> I wonder what should be the behavior for {{Types.BIT}}.
> The original discussion is here: https://github.com/pgjdbc/pgjdbc/issues/908
> PS. I'm not using Avatica + PostgreSQL + varbit combo yet, however I just 
> want to weight different implementation options, and make it simpler for 
> different JDBC implementations to talk to each other.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to