1267 if (attr) // this is a needed column. We need to convert
1268 {
1269 *(short*)&hdfsAsciiSourceData_[attr->getVCLenIndOffset()] = l en;
1270 if (attr->getNullFlag())
1271 {
1272 if (len == 0)
1273 *(short *)&hdfsAsciiSourceData_[attr->getNullIndOffset()] = -1;
1274 else if (memcmp(sourceData, "\\N", len) == 0)
1275 *(short *)&hdfsAsciiSourceData_[attr->getNullIndOffset()] = -1;
1276 else
1277 *(short *)&hdfsAsciiSourceData_[attr->getNullIndOffset()] = 0;
1278 }
The correct logic should be:
If (\N is the null indicator recorded in meta-data and the current string is “\N” || (\N is not the null indicator and len == 0) )
*(short *)&hdfsAsciiSourceData_[attr->getNullIndOffset()] = -1;
As a work-around, we can assume \N is the null indicator by default, and comment out line 1272 and 1273 and remove ‘else’ from line 1274.
From Qifan
Looks like the bug is in the following method
char * ExHdfsScanTcb: :extractAndTran sformAsciiSourc eToSqlRow( int &err,
ComDiagsAr ea* &diagsArea)
{
err = 0;
1267 if (attr) // this is a needed column. We need to convert )&hdfsAsciiSour ceData_ [attr-> getVCLenIndOffs et()] = l en; getNullFlag( )) rceData_ [attr-> getNullIndOffse t()] = -1; rceData_ [attr-> getNullIndOffse t()] = -1; rceData_ [attr-> getNullIndOffse t()] = 0;
1268 {
1269 *(short*
1270 if (attr->
1271 {
1272 if (len == 0)
1273 *(short *)&hdfsAsciiSou
1274 else if (memcmp(sourceData, "\\N", len) == 0)
1275 *(short *)&hdfsAsciiSou
1276 else
1277 *(short *)&hdfsAsciiSou
1278 }
The correct logic should be:
If (\N is the null indicator recorded in meta-data and the current string is “\N” || (\N is not the null indicator and len == 0) ) rceData_ [attr-> getNullIndOffse t()] = -1;
*(short *)&hdfsAsciiSou
As a work-around, we can assume \N is the null indicator by default, and comment out line 1272 and 1273 and remove ‘else’ from line 1274.