@Override public int compareTo(WritableRawComparable o) { FloatOption other = (FloatOption) o; if (nullValue | other.nullValue) { if (nullValue & other.nullValue) { return 0; } return nullValue ? -1 : +1; } int left = encode(value) - Integer.MIN_VALUE; int right = encode(other.value) - Integer.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.writeInt(encode(value)); } }