result = new WritableHiveCharObjectInspector((CharTypeInfo) typeInfo); break; case VARCHAR:
LazyBinaryHiveChar(WritableHiveCharObjectInspector oi) { super(oi); maxLength = ((CharTypeInfo)oi.getTypeInfo()).getLength(); data = new HiveCharWritable(); }
@Override public HiveCharWritable getPrimitiveWritableObject(Object o) { // check input object's length, if it doesn't match // then output new writable with correct params. if (o == null) { return null; } if ((o instanceof Text) || (o instanceof TimestampWritableV2) || (o instanceof HiveDecimalWritable) || (o instanceof DoubleWritable) || (o instanceof FloatWritable) || (o instanceof LongWritable) || (o instanceof IntWritable) || (o instanceof BooleanWritable)) { String str = o.toString(); HiveCharWritable hcw = new HiveCharWritable(); hcw.set(str, ((CharTypeInfo)typeInfo).getLength()); return hcw; } HiveCharWritable writable = ((HiveCharWritable) o); if (doesWritableMatchTypeParams((HiveCharWritable) o)) { return writable; } return getWritableWithParams(writable); }
@Override public HiveChar getPrimitiveJavaObject(Object o) { // check input object's length, if it doesn't match // then output a new primitive with the correct params. if (o == null) { return null; } if ((o instanceof Text) || (o instanceof TimestampWritableV2) || (o instanceof HiveDecimalWritable) || (o instanceof DoubleWritable) || (o instanceof FloatWritable) || (o instanceof LongWritable) || (o instanceof IntWritable) || (o instanceof BooleanWritable)) { String str = o.toString(); return new HiveChar(str, ((CharTypeInfo)typeInfo).getLength()); } HiveCharWritable writable = ((HiveCharWritable) o); if (doesWritableMatchTypeParams(writable)) { return writable.getHiveChar(); } return getPrimitiveWithParams(writable); }
} else if (outputOI instanceof WritableHiveCharObjectInspector) { WritableHiveCharObjectInspector writableHiveCharObjectOI = (WritableHiveCharObjectInspector) outputOI; int maxLength = ((CharTypeInfo) writableHiveCharObjectOI.getTypeInfo()).getLength(); BytesColumnVector bv = (BytesColumnVector) colVec; hiveCharWritable = ((HiveCharWritable) value); } else { hiveCharWritable = writableHiveCharObjectOI.getPrimitiveWritableObject(value);
@Override public Object set(Object o, HiveChar value) { if (value == null) { return null; } HiveCharWritable writable = (HiveCharWritable) o; writable.set(value, getMaxLength()); return o; }
new WritableHiveCharObjectInspector( (CharTypeInfo) primitiveTypeInfo); if (object instanceof HiveChar) { return writableCharObjectInspector.create((HiveChar) object); } else { return writableCharObjectInspector.copyObject(object);
} else { WritableHiveCharObjectInspector writableCharObjectInspector = new WritableHiveCharObjectInspector( (CharTypeInfo) primitiveTypeInfo); return writableCharObjectInspector.getPrimitiveJavaObject(object);
CharExtractorByValue(CharTypeInfo charTypeInfo, int columnIndex) { super(columnIndex); writableCharObjectInspector = new WritableHiveCharObjectInspector(charTypeInfo); object = writableCharObjectInspector.create(new HiveChar(StringUtils.EMPTY, -1)); text = new Text(); }
@Override public Object set(Object o, String value) { if (value == null) { return null; } HiveCharWritable writable = (HiveCharWritable) o; writable.set(value, getMaxLength()); return o; }
@Override public HiveChar getPrimitiveJavaObject(Object o) { // check input object's length, if it doesn't match // then output a new primitive with the correct params. if (o == null) { return null; } if (o instanceof Text) { String str = ((Text)o).toString(); return new HiveChar(str, ((CharTypeInfo)typeInfo).getLength()); } HiveCharWritable writable = ((HiveCharWritable) o); if (doesWritableMatchTypeParams(writable)) { return writable.getHiveChar(); } return getPrimitiveWithParams(writable); }
} else if (outputOI instanceof WritableHiveCharObjectInspector) { WritableHiveCharObjectInspector writableHiveCharObjectOI = (WritableHiveCharObjectInspector) outputOI; int maxLength = ((CharTypeInfo) writableHiveCharObjectOI.getTypeInfo()).getLength(); BytesColumnVector bv = (BytesColumnVector) colVec; hiveCharWritable = ((HiveCharWritable) value); } else { hiveCharWritable = writableHiveCharObjectOI.getPrimitiveWritableObject(value);
public Object copyObject(Object o) { if (o == null) { return null; } if (o instanceof Text) { String str = ((Text)o).toString(); HiveCharWritable hcw = new HiveCharWritable(); hcw.set(str, ((CharTypeInfo)typeInfo).getLength()); return hcw; } HiveCharWritable writable = (HiveCharWritable) o; if (doesWritableMatchTypeParams((HiveCharWritable) o)) { return new HiveCharWritable(writable); } return getWritableWithParams(writable); }
@Override public Object create(HiveChar value) { HiveCharWritable ret; ret = new HiveCharWritable(); ret.set(value, getMaxLength()); return ret; }
@Override public HiveChar getPrimitiveJavaObject(Object o) { // check input object's length, if it doesn't match // then output a new primitive with the correct params. if (o == null) { return null; } if (o instanceof Text) { String str = ((Text)o).toString(); return new HiveChar(str, ((CharTypeInfo)typeInfo).getLength()); } HiveCharWritable writable = ((HiveCharWritable) o); if (doesWritableMatchTypeParams(writable)) { return writable.getHiveChar(); } return getPrimitiveWithParams(writable); }
LazyBinaryHiveChar(WritableHiveCharObjectInspector oi) { super(oi); maxLength = ((CharTypeInfo)oi.getTypeInfo()).getLength(); data = new HiveCharWritable(); }
result = new WritableHiveCharObjectInspector((CharTypeInfo) typeInfo); break; case VARCHAR:
@Override public HiveCharWritable getPrimitiveWritableObject(Object o) { // check input object's length, if it doesn't match // then output new writable with correct params. if (o == null) { return null; } if (o instanceof Text) { String str = ((Text)o).toString(); HiveCharWritable hcw = new HiveCharWritable(); hcw.set(str, ((CharTypeInfo)typeInfo).getLength()); return hcw; } HiveCharWritable writable = ((HiveCharWritable) o); if (doesWritableMatchTypeParams((HiveCharWritable) o)) { return writable; } return getWritableWithParams(writable); }
private HiveCharWritable getWritableWithParams(HiveCharWritable val) { HiveCharWritable newValue = new HiveCharWritable(); newValue.set(val, getMaxLength()); return newValue; }
@Override public HiveChar getPrimitiveJavaObject(Object o) { // check input object's length, if it doesn't match // then output a new primitive with the correct params. if (o == null) { return null; } if (o instanceof Text) { String str = ((Text)o).toString(); return new HiveChar(str, ((CharTypeInfo)typeInfo).getLength()); } HiveCharWritable writable = ((HiveCharWritable) o); if (doesWritableMatchTypeParams(writable)) { return writable.getHiveChar(); } return getPrimitiveWithParams(writable); }