@Override public TajoDataTypes.Type type(int fieldId) { return values[fieldId].type(); }
@Override public int compareTo(Datum datum) { if (datum.type() == TajoDataTypes.Type.TIMESTAMP) { TimestampDatum another = (TimestampDatum) datum; return Longs.compare(timestamp, another.timestamp); } else if (datum.isNull()) { return -1; } else { throw new InvalidOperationException(datum.type()); } }
@Override public Datum minus(Datum datum) { if (datum.type() == TajoDataTypes.Type.INTERVAL) { IntervalDatum other = (IntervalDatum) datum; return new IntervalDatum(months - other.months, milliseconds - other.milliseconds); } else { throw new InvalidOperationException("operator does not exist: " + type() + " - " + datum.type()); } }
@Override public int compareTo(Datum datum) { if (datum.type() == TajoDataTypes.Type.PROTOBUF) { return value.equals(((ProtobufDatum)datum).get()) ? 0 : -1; } else { return -1; } }
@Override public Datum equalsTo(Datum datum) { switch (datum.kind()) { case BIT: return DatumFactory.createBool(this.val == (((BitDatum) datum).val)); case NULL_TYPE: return datum; default: throw new InvalidOperationException(datum.type()); } }
@Override public int compareTo(Datum datum) { if (datum.kind() == TajoDataTypes.Type.TIME) { TimeDatum another = (TimeDatum)datum; return Longs.compare(time, another.time); } else if (datum.isNull()) { return -1; } else { throw new InvalidOperationException(datum.type()); } }
@Override public int compareTo(Datum datum) { if (datum.kind() == TajoDataTypes.Type.TIMESTAMP) { TimestampDatum another = (TimestampDatum) datum; return Longs.compare(timestamp, another.timestamp); } else if (datum.isNull()) { return -1; } else { throw new InvalidOperationException(datum.type()); } }
public Datum lessThanEqual(Datum datum) { if (type.isNull() || datum.type().isNull()) { return NullDatum.get(); } return DatumFactory.createBool(compareTo(datum) <= 0); }
@Override public Datum equalsTo(Datum datum) { if (datum.kind() == Type.DATE) { return DatumFactory.createBool(equals(datum)); } else if (datum.isNull()) { return datum; } else { throw new InvalidOperationException(datum.type()); } }