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

ASF GitHub Bot commented on TRAFODION-762:
------------------------------------------

Github user zellerh commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/496#discussion_r64678643
  
    --- Diff: core/sql/optimizer/NATable.cpp ---
    @@ -3553,6 +3553,48 @@ NAType* getSQColTypeForHive(const char* hiveType, 
NAMemory* heap)
       if ( !strcmp(hiveType, "timestamp"))
         return new (heap) SQLTimestamp(TRUE /* allow NULL */ , 6, heap);
     
    +  if ( !strcmp(hiveType, "date"))
    +    return new (heap) SQLDate(TRUE /* allow NULL */ , heap);
    +
    +  if ( !strncmp(hiveType, "varchar", 7) )
    +  {
    +    char maxLen[32];
    +    memset(maxLen, 0, 32);
    +    int i=0,j=0;
    +    int copyit = 0;
    +
    +    //get length
    +    for(i = 0; i < strlen(hiveType) ; i++)
    +    {
    +      if(hiveType[i] == '(') //start
    +      {
    +        copyit=1;
    +        continue;
    +      }
    +      else if(hiveType[i] == ')') //stop
    +        break; 
    +      if(copyit > 0)
    +      {
    +        maxLen[j] = hiveType[i];
    +        j++;
    +      }
    +    }
    +    Int32 len = atoi(maxLen);
    +
    +    if(len == 0) return NULL;  //cannot parse correctly
    +
    +    NAString hiveCharset =
    +        ActiveSchemaDB()->getDefaults().getValue(HIVE_DEFAULT_CHARSET);
    +
    +    return new (heap) SQLVarChar(CharLenInfo((hiveCharset == 
CharInfo::UTF8 ? 0 : len),len),
    --- End diff --
    
    Yes, that would be good, agree, just would require some application 
changes, maybe we would have to deprecate the old CQD instead of removing it. 
I'll also send an email to the user list to ask this question.


> LP Bug: 1392452 - Support new Hive data types such as CHAR
> ----------------------------------------------------------
>
>                 Key: TRAFODION-762
>                 URL: https://issues.apache.org/jira/browse/TRAFODION-762
>             Project: Apache Trafodion
>          Issue Type: Wish
>          Components: sql-cmp
>            Reporter: Hans Zeller
>            Assignee: liu ming
>            Priority: Minor
>
> Hive now seems to support data types that match Trafodion types very well.
> According to 
> https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-Create/Drop/TruncateTable
> Hive 0.11 supports DECIMAL
> Hive 0.12 supports VARCHAR
> Hive 0.13 supports CHAR, DECIMAL(precision, scale)



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

Reply via email to