@Override public int compareTo(WritableRawComparable o) { DoubleOption other = (DoubleOption) o; if (nullValue | other.nullValue) { if (nullValue & other.nullValue) { return 0; } return nullValue ? -1 : +1; } long left = encode(value) - Long.MIN_VALUE; long right = encode(other.value) - Long.MIN_VALUE; if (left == right) { return 0; } if (left < right) { return -1; } return +1; }
@Override public void write(DataOutput out) throws IOException { if (isNull()) { out.writeBoolean(false); } else { out.writeBoolean(true); out.writeLong(encode(value)); } }