private String getObjectDisplayString(Object object) {
    StringBuilder sb = new StringBuilder();

    if (object == null) {
      sb.append("NULL");
    } else if (object instanceof Text ||
               object instanceof HiveChar || object instanceof HiveCharWritable ||
               object instanceof HiveVarchar || object instanceof HiveVarcharWritable) {
        final String string;
        if (object instanceof Text) {
          Text text = (Text) object;
          string = text.toString();
        } else if (object instanceof HiveChar) {
          HiveChar hiveChar = (HiveChar) object;
          string = hiveChar.getStrippedValue();
        } else if (object instanceof HiveCharWritable) {
          HiveChar hiveChar = ((HiveCharWritable) object).getHiveChar();
          string = hiveChar.getStrippedValue();
        } else if (object instanceof HiveVarchar) {
          HiveVarchar hiveVarchar = (HiveVarchar) object;
          string = hiveVarchar.getValue();
        } else if (object instanceof HiveVarcharWritable) {
          HiveVarchar hiveVarchar = ((HiveVarcharWritable) object).getHiveVarchar();
          string = hiveVarchar.getValue();
        } else {
          throw new RuntimeException("Unexpected");
        }

        byte[] bytes = string.getBytes();
        final int byteLength = bytes.length;

        sb.append("'");
        sb.append(string);
        sb.append("' (byte length ");
        sb.append(bytes.length);
        sb.append(", string length ");
        sb.append(string.length());
        sb.append(", bytes ");
        sb.append(VectorizedBatchUtil.displayBytes(bytes, 0, byteLength));
        sb.append(")");
    } else {
      sb.append(object.toString());
    }
    return sb.toString();
  }
Unit test for the vectorized serialize and deserialize row.
ql/src/test/org/apache/hadoop/hive/ql/exec/vector/TestVectorSerDeRow.java