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

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

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

    
https://github.com/apache/incubator-trafodion/pull/1055#discussion_r110632142
  
    --- Diff: core/sql/executor/ExHdfsScan.cpp ---
    @@ -1653,7 +1653,7 @@ char * 
ExHdfsScanTcb::extractAndTransformAsciiSourceToSqlRow(int &err,
                       // for non-varchar, length of zero indicates a null 
value.
                       // For all datatypes, HIVE_DEFAULT_NULL_STRING('\N') 
indicates a null value.
                       if (((len == 0) && (tgtAttr && (NOT 
DFS2REC::isSQLVarChar(tgtAttr->getDatatype())))) ||
    -                      ((len > 0) && (memcmp(sourceData, 
HIVE_DEFAULT_NULL_STRING, len) == 0)))
    +                      ((len > 1) && (memcmp(sourceData, 
HIVE_DEFAULT_NULL_STRING, len) == 0)))
    --- End diff --
    
    This can handle the '\' problem, but if (not possible) the user define '\' 
as null, this logic will break.
    So here, it should be to compare the whole HIVE_DEFAULT_NULL_STRING, and 
make sure length is equal, as I understand.
    \N is NULL, but \NA is not NULL, what will happen if there is \NAA ?


> Trafodion treat '\' as NULL in hive table
> -----------------------------------------
>
>                 Key: TRAFODION-2483
>                 URL: https://issues.apache.org/jira/browse/TRAFODION-2483
>             Project: Apache Trafodion
>          Issue Type: Bug
>            Reporter: liu ming
>            Assignee: Yang, Yongfeng
>
> If the source data in a hive table have '\', it will be mistakenly treated as 
> NULL value ('\N').
> Not correct string comparing inside 
> ExHdfsScanTcb::extractAndTransformAsciiSourceToSqlRow



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to