this.fields = fields;
}
@Override
public Object next(Object previous) throws IOException {
OrcUnion result = null;
if (valuePresent) {
if (previous == null) {
result = new OrcUnion();
} else {
result = (OrcUnion) previous;
}
byte tag = nextTag();
Object previousVal = result.getObject();
result.set(tag, fields[tag].getInComplexType(tag == result.getTag() ?
previousVal : null, previousRow));
}
return result;
}