private Writable getWritableValue(TypeInfo ti, byte[] value) {
    if (ti.equals(TypeInfoFactory.stringTypeInfo)) {
      return new Text(value);
    } else if (ti.equals(TypeInfoFactory.varcharTypeInfo)) {
      return new HiveVarcharWritable(
          new HiveVarchar(new Text(value).toString(), -1));
    } else if (ti.equals(TypeInfoFactory.binaryTypeInfo)) {
      return new BytesWritable(value);
    }
    return null;
  }
Unit tests for vector expression writers.
ql/src/test/org/apache/hadoop/hive/ql/exec/vector/expressions/TestVectorExpressionWriters.java