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

    https://github.com/apache/incubator-trafodion/pull/496#discussion_r64498774
  
    --- Diff: core/sql/executor/ExExeUtilGet.cpp ---
    @@ -4940,6 +4946,41 @@ Lng32 
ExExeUtilHiveMDaccessTcb::getLengthFromHiveColType(const char* hiveType)
       if ( !strcmp(hiveType, "timestamp"))
         return 26; //Is this internal or display length? REC_DATETIME;
     
    +  if ( !strcmp(hiveType, "date"))
    +    return 10; //Is this internal or display length? REC_DATETIME;
    +  
    +  if ( !strncmp(hiveType, "varchar",7) )
    +  {
    +    //try to get the length
    +    char maxLen[32];
    +    memset(maxLen, 0, 32);
    +    int i=0,j=0;
    +    short copyit = 0;
    +
    +    if(strlen(hiveType) > 39)  return -1;  
    + 
    +    for(i = 0; i < strlen(hiveType) ; i++)
    +    {
    +      if(hiveType[i] == '(')  
    +      {
    +        copyit=1;
    +        continue;
    +      }
    +      else if(hiveType[i] == ')')  
    +        break;
    +      if(copyit == 1 )
    +      {
    +        maxLen[j] = hiveType[i];
    +        j++;
    +      }
    +    }
    +
    --- End diff --
    
    Valid VARCHAR definition will only contain digit between the parenthesis, 
and this comes from Hive metastore, should be valid, otherwise Hive not allow 
the wrong varchar type to be created. And for safety, if the atoi() return 0, 
the code will treat this as a unknown data type. 


---
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