@Override public int hashCode() { long seconds = getSeconds(); seconds <<= 30; // the nanosecond part fits in 30 bits seconds |= getNanos(); return (int) ((seconds >>> 32) ^ seconds); }
/** * * @return nanoseconds in this TimestampWritable */ public int getNanos() { if (!timestampEmpty) { return timestamp.getNanos(); } else if (!bytesEmpty) { return hasDecimalOrSecondVInt() ? TimestampWritable.getNanos(currentBytes, offset + 4) : 0; } else { throw new IllegalStateException("Both timestamp and bytes are empty"); } }
private void populateTimestamp() { long seconds = getSeconds(); int nanos = getNanos(); timestamp.setTime(seconds * 1000); timestamp.setNanos(nanos); }
/** * * @return double representation of the timestamp, accurate to nanoseconds */ public double getDouble() { double seconds, nanos; if (bytesEmpty) { seconds = TimestampUtils.millisToSeconds(timestamp.getTime()); nanos = timestamp.getNanos(); } else { seconds = getSeconds(); nanos = getNanos(); } return seconds + nanos / 1000000000; }
public static void setTimestamp(Timestamp t, byte[] bytes, int offset) { long seconds = getSeconds(bytes, offset); t.setTime(seconds * 1000); if (hasDecimalOrSecondVInt(bytes[offset])) { t.setNanos(getNanos(bytes, offset + 4)); } else { t.setNanos(0); } }
public BooleanWritable evaluate(TimestampWritable i) { if (i == null) { return null; } else { booleanWritable.set(i.getSeconds() != 0 || i.getNanos() != 0); return booleanWritable; } }
/** * @return byte[] representation of TimestampWritable that is binary * sortable (7 bytes for seconds, 4 bytes for nanoseconds) */ public byte[] getBinarySortable() { 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; }
actualValue = sqlTimestampOf((timestamp.getSeconds() * 1000) + (timestamp.getNanos() / 1000000L), SESSION);
TimestampWritable timestamp = (TimestampWritable) actualValue; if (SESSION.isLegacyTimestamp()) { actualValue = new SqlTimestamp((timestamp.getSeconds() * 1000) + (timestamp.getNanos() / 1000000L), UTC_KEY); actualValue = new SqlTimestamp((timestamp.getSeconds() * 1000) + (timestamp.getNanos() / 1000000L));
@Override public int hashCode() { long seconds = getSeconds(); seconds <<= 30; // the nanosecond part fits in 30 bits seconds |= getNanos(); return (int) ((seconds >>> 32) ^ seconds); }
@Override public int hashCode() { long seconds = getSeconds(); seconds <<= 30; // the nanosecond part fits in 30 bits seconds |= getNanos(); return (int) ((seconds >>> 32) ^ seconds); }
@Override public int hashCode() { long seconds = getSeconds(); seconds <<= 30; // the nanosecond part fits in 30 bits seconds |= getNanos(); return (int) ((seconds >>> 32) ^ seconds); }
private void populateTimestamp() { long seconds = getSeconds(); int nanos = getNanos(); timestamp.setTime(seconds * 1000); timestamp.setNanos(nanos); }
private void populateTimestamp() { long seconds = getSeconds(); int nanos = getNanos(); timestamp.setTime(seconds * 1000); timestamp.setNanos(nanos); }
private void populateTimestamp() { long seconds = getSeconds(); int nanos = getNanos(); timestamp.setTime(seconds * 1000); timestamp.setNanos(nanos); }
private void populateTimestamp() { long seconds = getSeconds(); int nanos = getNanos(); timestamp.setTime(seconds * 1000); timestamp.setNanos(nanos); }
public BooleanWritable evaluate(TimestampWritable i) { if (i == null) { return null; } else { booleanWritable.set(i.getSeconds() != 0 || i.getNanos() != 0); return booleanWritable; } }
public static void setTimestamp(Timestamp t, byte[] bytes, int offset) { long seconds = getSeconds(bytes, offset); t.setTime(seconds * 1000); if (hasDecimalOrSecondVInt(bytes[offset])) { t.setNanos(getNanos(bytes, offset + 4)); } else { t.setNanos(0); } }
@Override public void setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex) { final TimestampWritable value = ((TimestampObjectInspector)oi).getPrimitiveWritableObject(hiveFieldValue); long seconds = value.getSeconds(); long nanos = value.getNanos(); long millis = seconds * 1000 + nanos/1000/1000; ((TimeStampMilliVector) outputVV).setSafe(outputIndex, millis); } }