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

    https://github.com/apache/incubator-trafodion/pull/414#discussion_r58537932
  
    --- Diff: core/sql/executor/ExHdfsScan.h ---
    @@ -429,41 +432,92 @@ class ExOrcFastAggrTcb  : public ExOrcScanTcb
     
     #define RANGE_DELIMITER '\002'
     
    -inline char *hdfs_strchr(const char *s, int c, const char *end, NABoolean 
checkRangeDelimiter)
    +inline char *hdfs_strchr(char *s, int c, const char *end, NABoolean 
checkRangeDelimiter, int mode = 0)
     {
       char *curr = (char *)s;
    -
    -  while (curr < end) {
    +  int count=0;
    +  if( (mode & HIVE_MODE_DOSFORMAT ) == 0)
    +  {
    +   while (curr < end) {
         if (*curr == c)
    +    {
            return curr;
    +    }
         if (checkRangeDelimiter &&*curr == RANGE_DELIMITER)
            return NULL;
         curr++;
    +   }
    +  }
    +  else
    +  {
    +   while (curr < end) {
    +     if (*curr == c)
    +     {
    +         if(count>0 && c == '\n')
    +         {
    +           if(s[count-1] == '\r') s[count-1] = ' '; 
    +         }
    +         return curr;
    +      }
    +      if (checkRangeDelimiter &&*curr == RANGE_DELIMITER)
    +         return NULL;
    +    curr++;
    +    count++;
    +   }
       }
       return NULL;
     }
     
     
    -inline char *hdfs_strchr(const char *s, int rd, int cd, const char *end, 
NABoolean checkRangeDelimiter, NABoolean *rdSeen)
    +inline char *hdfs_strchr(char *s, int rd, int cd, const char *end, 
NABoolean checkRangeDelimiter, NABoolean *rdSeen, int mode = 0)
     {
       char *curr = (char *)s;
    -
    -  while (curr < end) {
    -    if (*curr == rd) {
    -       *rdSeen = TRUE;
    -       return curr;
    -    }
    -    else
    -    if (*curr == cd) {
    -       *rdSeen = FALSE;
    -       return curr;
    +  int count = 0;
    +  if( (mode & HIVE_MODE_DOSFORMAT)>0 )  //check outside the while loop to 
make it faster
    +  {
    +    while (curr < end) {
    +      if (*curr == rd) {
    +         if(count>0 && rd == '\n')
    +         {
    +             if(s[count-1] == '\r') s[count-1] = ' ';
    --- End diff --
    
    Same comment as above


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