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

Laurent Goujon commented on DRILL-4420:
---------------------------------------

The C++ function {{std::string getSQLType(common::MinorType, 
common::DataMode)}} is the equivalent of the Java method 
{{org.apache.drill.common.Types#getSqlTypeName(final MajorType)}} which is was 
is populating values for {{ColumnMetadata::getDataType()}}, so the returned 
types should be consistent across API. As for can these types be used for CAST 
or CREATE TABLE, I don't see why it would not be the case, although I'm not 
sure to see a scenario when someone would use the returned the SQL type to do a 
CAST. For CREATE TABLE, Drill doesn't it except for CREATE TABLE AS (but you 
don't provide the schema), so is the question about that the type returned by 
Drill valid for another vendor? I don't think we can guarantee that.

For signed vs unsigned, it's all about support by vendor. For example MySQL 
support both signed and unsigned types: 
{code:sql}
CREATE TABLE tinyint_table(c1 TINYINT UNSIGNED)
{code}
The type is really {{TINYINT}}, and UNSIGNED is just a qualifier (like 
precision or radix), with default being signed. For the ODBC driver it means 
the ODBC C type returned by the driver might have to be adjusted (like 
returning {{SQLSMALLINT}} vs {{SQLUSMALLINT}})

> C client and ODBC driver should move to using the new metadata methods 
> provided by DRILL-4385
> ---------------------------------------------------------------------------------------------
>
>                 Key: DRILL-4420
>                 URL: https://issues.apache.org/jira/browse/DRILL-4420
>             Project: Apache Drill
>          Issue Type: Sub-task
>            Reporter: Jacques Nadeau
>




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

Reply via email to