You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Dave Maughan <da...@gmail.com> on 2015/04/01 11:56:58 UTC

ORC HiveChar, HiveVarchar & HiveDecimal

Hi,

I'm attempting to write a ReaderReader and RecordWriter for ORC that
support reading and writing String for HiveChar and HiveVarchar and
BigDecimal for HiveDecimal to simplify usage a little - I need Serializable
types.

To do this I've gone the ObjectInspector route, eg:

  ... extends JavaHiveCharObjectInspector {

  @Override
  public HiveCharWritable getPrimitiveWritableObject(Object o) {
    if (o == null) {
      return null;
    }
    if (o instanceof String) {
      o = new HiveChar((String) o, getMaxLength());
    }
    return super.getPrimitiveWritableObject(o);
  }

To get the object nesting working I've also had to implement a factory that
delegates to my ObjectInspectors when CharTypeInfo, VarcharTypeInfo or
DecimalTypeInfo are encountered during the traversal of the TypeInfo tree.

I've got this all working except for one minor problem. In my
StructObjectInspector I need access to the OrcStruct constructor and the
getFieldValue and setFieldValue methods. All of these are package private.
Would it acceptable to submit a patch to make these public or is it
preferable to keep them package private? Alternatively, is there another
way to achieve what I'm trying to do that I've missed?

Regards,
Dave