public long getSeconds() { if (!timestampTZEmpty) { return timestampTZ.getEpochSecond(); } else if (!bytesEmpty) { return getSeconds(currentBytes, offset); } throw new IllegalStateException("Both timestamp and bytes are empty"); }
private void populateTimestampTZ() { if (timestampTZEmpty) { if (bytesEmpty) { throw new IllegalStateException("Bytes are empty"); } long seconds = getSeconds(currentBytes, offset); int nanos = hasDecimalOrSecondVInt(currentBytes[offset]) ? getNanos(currentBytes, offset + 4) : 0; timestampTZ.set(seconds, nanos, timeZone); timestampTZEmpty = false; } }
public byte[] toBinarySortable() { byte[] b = new byte[BINARY_SORTABLE_LENGTH]; int nanos = getNanos(); // We flip the highest-order bit of the seven-byte representation of seconds to make negative // values come before positive ones. long seconds = getSeconds() ^ SEVEN_BYTE_LONG_SIGN_FLIP; sevenByteLongToBytes(seconds, b, 0); intToBytes(nanos, b, 7); return b; }
public static void setTimestampTZ(TimestampTZ t, byte[] bytes, int offset, ZoneId timeZone) { long seconds = getSeconds(bytes, offset); int nanos = hasDecimalOrSecondVInt(bytes[offset]) ? getNanos(bytes, offset + 4) : 0; t.set(seconds, nanos, timeZone); }
case TIMESTAMPLOCALTZ: result = ((TimestampLocalTZObjectInspector) oi).getPrimitiveWritableObject(o) .getSeconds(); break; case DECIMAL:
public long getSeconds() { if (!timestampTZEmpty) { return timestampTZ.getEpochSecond(); } else if (!bytesEmpty) { return getSeconds(currentBytes, offset); } throw new IllegalStateException("Both timestamp and bytes are empty"); }
private void populateTimestampTZ() { if (timestampTZEmpty) { if (bytesEmpty) { throw new IllegalStateException("Bytes are empty"); } long seconds = getSeconds(currentBytes, offset); int nanos = hasDecimalOrSecondVInt(currentBytes[offset]) ? getNanos(currentBytes, offset + 4) : 0; timestampTZ.set(seconds, nanos, timeZone); timestampTZEmpty = false; } }
public byte[] toBinarySortable() { byte[] b = new byte[BINARY_SORTABLE_LENGTH]; int nanos = getNanos(); // We flip the highest-order bit of the seven-byte representation of seconds to make negative // values come before positive ones. long seconds = getSeconds() ^ SEVEN_BYTE_LONG_SIGN_FLIP; sevenByteLongToBytes(seconds, b, 0); intToBytes(nanos, b, 7); return b; }
public static void setTimestampTZ(TimestampTZ t, byte[] bytes, int offset, ZoneId timeZone) { long seconds = getSeconds(bytes, offset); int nanos = hasDecimalOrSecondVInt(bytes[offset]) ? getNanos(bytes, offset + 4) : 0; t.set(seconds, nanos, timeZone); }