public void setTime(long time) { timestamp.setTime(time); bytesEmpty = true; timestampEmpty = false; }
@Override public void reset () { isNull = true; this.value.setTime(0); } }
@Override public Timestamp copy(Timestamp from, Timestamp reuse) { if (from == null) { return null; } reuse.setTime(from.getTime()); reuse.setNanos(from.getNanos()); return reuse; }
/** * Set a Timestamp object from a row of the column. * We assume the entry has already been NULL checked and isRepeated adjusted. * @param timestamp * @param elementNum */ public void timestampUpdate(Timestamp timestamp, int elementNum) { timestamp.setTime(time[elementNum]); timestamp.setNanos(nanos[elementNum]); }
/** * Return the scratch Timestamp object set from a row. * We assume the entry has already been NULL checked and isRepeated adjusted. * @param elementNum * @return */ public Timestamp asScratchTimestamp(int elementNum) { scratchTimestamp.setTime(time[elementNum]); scratchTimestamp.setNanos(nanos[elementNum]); return scratchTimestamp; }
@Override public void assignNullTimestamp(int keyIndex, int index) { isNull[keyIndex] = true; // assign 0 to simplify hashcode timestampValues[index].setTime(ZERO_TIMESTAMP.getTime()); timestampValues[index].setNanos(ZERO_TIMESTAMP.getNanos()); }
public DateScalarAddIntervalDayTimeColumn(long value, int colNum, int outputColumnNum) { super(outputColumnNum); // Scalar input #1 is type date (days). For the math we convert it to a timestamp. this.value = new Timestamp(0); this.value.setTime(DateWritableV2.daysToMillis((int) value)); this.colNum = colNum; }
/** * Return a long representation of a Timestamp. * @param elementNum * @return */ public long getTimestampAsLong(int elementNum) { scratchTimestamp.setTime(time[elementNum]); scratchTimestamp.setNanos(nanos[elementNum]); return getTimestampAsLong(scratchTimestamp); }
public DateScalarSubtractTimestampColumn(long value, int colNum, int outputColumnNum) { super(outputColumnNum); // Scalar input #1 is type date (days). For the math we convert it to a timestamp. this.value = new Timestamp(0); this.value.setTime(DateWritableV2.daysToMillis((int) value)); this.colNum = colNum; }
public DateScalarSubtractDateColumn(long value, int colNum, int outputColumnNum) { super(outputColumnNum); this.colNum = colNum; this.value = new Timestamp(0); this.value.setTime(DateWritableV2.daysToMillis((int) value)); }
public IntervalDayTimeColAddDateScalar(int colNum, long value, int outputColumnNum) { super(outputColumnNum); this.colNum = colNum; this.value = new Timestamp(0); this.value.setTime(DateWritableV2.daysToMillis((int) value)); }
public DateScalarSubtractIntervalDayTimeColumn(long value, int colNum, int outputColumnNum) { super(outputColumnNum); // Scalar input #1 is type date (days). For the math we convert it to a timestamp. this.value = new Timestamp(0); this.value.setTime(DateWritableV2.daysToMillis((int) value)); this.colNum = colNum; }
/** * Return a double representation of a Timestamp. * @param elementNum * @return */ public double getDouble(int elementNum) { scratchTimestamp.setTime(time[elementNum]); scratchTimestamp.setNanos(nanos[elementNum]); return getDouble(scratchTimestamp); }
@Override public Timestamp deserialize(Timestamp reuse, DataInputView source) throws IOException { final long v = source.readLong(); if (v == Long.MIN_VALUE) { return null; } reuse.setTime(v); reuse.setNanos(source.readInt()); return reuse; }
@Deprecated public boolean add(java.sql.Timestamp ts, HiveIntervalYearMonth interval, java.sql.Timestamp result) { if (ts == null || interval == null) { return false; } // Attempt to match Oracle semantics for timestamp arithmetic, // where timestamp arithmetic is done in UTC, then converted back to local timezone long resultMillis = addMonthsToMillis(ts.getTime(), interval.getTotalMonths()); result.setTime(resultMillis); result.setNanos(ts.getNanos()); return true; }
@Deprecated public boolean add(HiveIntervalYearMonth interval, java.sql.Timestamp ts, java.sql.Timestamp result) { if (ts == null || interval == null) { return false; } long resultMillis = addMonthsToMillis(ts.getTime(), interval.getTotalMonths()); result.setTime(resultMillis); result.setNanos(ts.getNanos()); return true; }
private void populateTimestamp() { long seconds = getSeconds(); int nanos = getNanos(); timestamp.setTime(seconds * 1000); timestamp.setNanos(nanos); }
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); } }
private void setMilliseconds(TimestampColumnVector timestampColVector, long[] vector, int elementNum) { timestampColVector.getScratchTimestamp().setTime(vector[elementNum]); timestampColVector.setFromScratchTimestamp(elementNum); }