return new LazyUnion(lazyUnionOI, tag, convertedObj);
public static boolean lazyCompareUnion(UnionTypeInfo unionTypeInfo, LazyUnion union, UnionObject expectedUnion) { byte tag = union.getTag(); byte expectedTag = expectedUnion.getTag(); if (tag != expectedTag) { throw new RuntimeException("Union tag does not match union.getTag() " + tag + " expectedUnion.getTag() " + expectedTag); } return lazyCompare(unionTypeInfo.getAllUnionObjectTypeInfos().get(tag), union.getField(), expectedUnion.getObject()); }
/** * Get the field out of the union. * * @return The field as a LazyObject */ public Object getField() { if (fieldSet) { return field; } if (!parsed) { parse(); } return uncheckedGetField(); }
@Override public byte getTag(Object data) { if (data == null) { return -1; } return ((LazyUnion) data).getTag(); } }
@Override public Object getField(Object data) { if (data == null) { return null; } return ((LazyUnion) data).getField(); }
/** * Get the tag of the union * * @return The tag byte */ public byte getTag() { if (fieldSet) { return tag; } if (!parsed) { parse(); } return tag; } }
/** * Get the field out of the row without checking parsed. * * @return The value of the field */ @SuppressWarnings("rawtypes") private Object uncheckedGetField() { LazyObject field = (LazyObject) this.field; if (fieldInited) { return field.getObject(); } fieldInited = true; int fieldStart = startPosition; int fieldLength = start + length - startPosition; if (isNull(oi.getNullSequence(), bytes, fieldStart, fieldLength)) { field.setNull(); } else { field.init(bytes, fieldStart, fieldLength); } return field.getObject(); }
@Override public byte getTag(Object data) { if (data == null) { return -1; } return ((LazyUnion) data).getTag(); } }
@Override public Object getField(Object data) { if (data == null) { return null; } return ((LazyUnion) data).getField(); }
/** * Get the tag of the union * * @return The tag byte */ public byte getTag() { if (!parsed) { parse(); } return tag; } }
/** * Get the field out of the row without checking parsed. * * @return The value of the field */ @SuppressWarnings("rawtypes") private Object uncheckedGetField() { LazyObject field = (LazyObject) this.field; if (fieldInited) { return field.getObject(); } fieldInited = true; int fieldStart = startPosition; int fieldLength = start + length - startPosition; if (isNull(oi.getNullSequence(), bytes, fieldStart, fieldLength)) { field.setNull(); } else { field.init(bytes, fieldStart, fieldLength); } return field.getObject(); }
/** * Get the field out of the union. * * @return The field as a LazyObject */ public Object getField() { if (!parsed) { parse(); } return uncheckedGetField(); }
/** * Create a hierarchical LazyObject based on the given typeInfo. */ public static LazyObject<? extends ObjectInspector> createLazyObject(ObjectInspector oi) { ObjectInspector.Category c = oi.getCategory(); switch (c) { case PRIMITIVE: return createLazyPrimitiveClass((PrimitiveObjectInspector) oi); case MAP: return new LazyMap((LazyMapObjectInspector) oi); case LIST: return new LazyArray((LazyListObjectInspector) oi); case STRUCT: return new LazyStruct((LazySimpleStructObjectInspector) oi); case UNION: return new LazyUnion((LazyUnionObjectInspector) oi); } throw new RuntimeException("Hive LazySerDe Internal error."); }
public static boolean lazyCompareUnion(UnionTypeInfo unionTypeInfo, LazyUnion union, UnionObject expectedUnion) { byte tag = union.getTag(); byte expectedTag = expectedUnion.getTag(); if (tag != expectedTag) { throw new RuntimeException("Union tag does not match union.getTag() " + tag + " expectedUnion.getTag() " + expectedTag); } return lazyCompare(unionTypeInfo.getAllUnionObjectTypeInfos().get(tag), union.getField(), expectedUnion.getObject()); }
@Override public byte getTag(Object data) { if (data == null) { return -1; } return ((LazyUnion) data).getTag(); } }
@Override public Object getField(Object data) { if (data == null) { return null; } return ((LazyUnion) data).getField(); }
/** * Get the tag of the union * * @return The tag byte */ public byte getTag() { if (fieldSet) { return tag; } if (!parsed) { parse(); } return tag; } }
/** * Get the field out of the row without checking parsed. * * @return The value of the field */ @SuppressWarnings("rawtypes") private Object uncheckedGetField() { LazyObject field = (LazyObject) this.field; if (fieldInited) { return field.getObject(); } fieldInited = true; int fieldStart = startPosition; int fieldLength = start + length - startPosition; if (isNull(oi.getNullSequence(), bytes, fieldStart, fieldLength)) { field.setNull(); } else { field.init(bytes, fieldStart, fieldLength); } return field.getObject(); }
/** * Get the field out of the union. * * @return The field as a LazyObject */ public Object getField() { if (fieldSet) { return field; } if (!parsed) { parse(); } return uncheckedGetField(); }
return new LazyUnion(lazyUnionOI, tag, convertedObj);