Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-24280

Fix a potential NPE

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Patch Available
    • Trivial
    • Resolution: Unresolved
    • 3.1.2
    • None
    • Vectorization
    • None

    Description

              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;
      

      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.

      Attachments

        1. HIVE-24280.patch
          0.8 kB
          Xuefu Zhang

        Activity

          People

            xuefuz Xuefu Zhang
            xuefuz Xuefu Zhang
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: