Xuefu Zhang created HIVE-24280:
----------------------------------

             Summary: Fix a potential NPE
                 Key: HIVE-24280
                 URL: https://issues.apache.org/jira/browse/HIVE-24280
             Project: Hive
          Issue Type: Improvement
          Components: Vectorization
    Affects Versions: 3.1.2
            Reporter: Xuefu Zhang
            Assignee: Xuefu Zhang


{code:java}
        case STRING:
        case CHAR:
        case VARCHAR: {
          BytesColumnVector bcv = (BytesColumnVector) cols[colIndex];
          String sVal = value.toString();
          if (sVal == null) {
            bcv.noNulls = false;
            bcv.isNull[0] = true;
            bcv.isRepeating = true;
          } else {
            bcv.fill(sVal.getBytes());
          }
        }
        break;
{code}
The above code snippet seems assuming that sVal can be null, but didn't handle 
the case where value is null. However, if value is not null, it's unlikely that 
value.toString() returns null.

We treat partition column value for default partition of string types as null, 
not as "__HIVE_DEFAULT_PARTITION__", which Hive assumes. Thus, we actually hit 
the problem that sVal is null.

I propose a harmless fix, as shown in the attached patch.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to