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

Julian Hyde edited comment on CALCITE-1466 at 10/24/16 11:33 PM:
-----------------------------------------------------------------

I support the idea of adding UNSIGNED INTEGER etc. to Avatica's type system, 
but note that these types have different ranges than the unsigned types in 
Phoenix. For instance, UNSIGNED INTEGER has a range of 0 ... 2^31 - 1 
(4,294,967,295) in MySQL but a range of 0 ... 2^31 - 1 (2,147,483,647) in 
Phoenix. So, to solve Phoenix's problem we would need a different set of types.

If I'm reading the [ODBC 
headers|https://apt-browse.org/browse/ubuntu/trusty/main/i386/libiodbc2-dev/3.52.7-3.1/file/usr/include/sqlext.h]
 correctly, the type codes are as follows:

{noformat}
SQL name          C name         Code                        Min                
        Max
================= ============== ==== ========================== 
==========================
BIGINT            SQL_C_BIGINT     -5 -9,223,372,036,854,775,808  
9,223,372,036,854,775,807
INTEGER           SQL_C_LONG        4             -2,147,483,648              
2,147,483,647
SMALLINT          SQL_C_SHORT       5                    -32,768                
     32,767
TINYINT           SQL_C_TINYINT    -6                       -128                
        127
UNSIGNED BIGINT   SQL_C_UBIGINT   -27                          0 
18,446,744,073,709,551,615
UNSIGNED INTEGER  SQL_C_ULONG     -18                          0              
4,294,967,295
UNSIGNED SMALLINT SQL_C_USHORT    -17                          0                
     65,536
UNSIGNED TINYINT  SQL_C_UTINYINT  -28                          0                
        256
{noformat}



was (Author: julianhyde):
I support the idea of adding UNSIGNED INTEGER etc. to Avatica's type system, 
but note that these types have different ranges than the unsigned types in 
Phoenix. For instance, UNSIGNED INTEGER has a range of 0 ... 2^31 - 1 
(4,294,967,295) in MySQL but a range of 0 ... 2^31 - 1 (2,147,483,647) in 
Phoenix. So, to solve Phoenix's problem we would need a different set of types.

If I'm reading the [ODBC 
headers|https://apt-browse.org/browse/ubuntu/trusty/main/i386/libiodbc2-dev/3.52.7-3.1/file/usr/include/sqlext.h]
 correctly, the type codes are as follows:

{noformat}
SQL name          C name         Code
================= ============== ====
BIGINT            SQL_C_BIGINT     -5
INTEGER           SQL_C_LONG        4
SMALLINT          SQL_C_SHORT       5
TINYINT           SQL_C_TINYINT    -6
UNSIGNED BIGINT   SQL_C_UBIGINT   -27
UNSIGNED INTEGER  SQL_C_ULONG     -18
UNSIGNED SMALLINT SQL_C_USHORT    -17
UNSIGNED TINYINT  SQL_C_UTINYINT  -28
{noformat}


> Support for UNSIGNED types of int,long,float etc. in type system
> ----------------------------------------------------------------
>
>                 Key: CALCITE-1466
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1466
>             Project: Calcite
>          Issue Type: Bug
>          Components: avatica
>            Reporter: Rajeshbabu Chintaguntla
>
> There are some data bases like MySQL supporting unsigned data types.  Apache 
> Phoenix also supports them. Would be great to add them to calcite as well.
> http://dev.mysql.com/doc/refman/5.7/en/integer-types.html



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to