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

    https://github.com/apache/incubator-trafodion/pull/496#discussion_r64499224
  
    --- 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 --
    
    I just copy the code from 'string' case, and assume it is correct :-) Need 
to modify the code here, yes.
    
    I prefer to change the default behavior of hive HIVE varchar(32) into 
Trafodion varchar(32 bytes) character set utf8, to make it same as string. I 
hope to avoid another CQD. What do you think? 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to