@Override public void write(DataOutput out) throws IOException { out.writeInt(groupId); out.writeInt(partitioningColumnId == null ? -1 : partitioningColumnId); out.writeInt(tableId); out.writeInt(ranges == null ? -1 : ranges.length); if (ranges != null) { for (ValueRange range : ranges) { if (range == null) { range = new ValueRange(); // this will not happen, but let's make it sure } range.write(out); } } out.writeInt(linkedGroupId == null ? -1 : linkedGroupId.intValue()); }
@Override public void readFields(DataInput in) throws IOException { groupId = in.readInt(); partitioningColumnId = in.readInt(); if (partitioningColumnId < 0) { partitioningColumnId = null; } tableId = in.readInt(); int len = in.readInt(); if (len < 0) { ranges = null; } else { ranges = new ValueRange[len]; for (int i = 0; i < len; ++i) { ranges[i] = ValueRange.read(in); } } linkedGroupId = in.readInt(); if (linkedGroupId == -1) { linkedGroupId = null; } }