long value = ts.getMillis(); for (int i = start; i < end; i++) { v.getMutator().setSafe(i, value);
@Override public void load(int rowIndex, String value) { try { Date d = df.parse(value); long milliseconds = d.getTime(); mutator.set(rowIndex, milliseconds); } catch (NumberFormatException e) { throw UserException .dataReadError(e) .addContext("Failed to parse a TIMESTAMP field") .addContext("Column", getName()) .addContext("Position", getIndex()) .addContext("Value", value) .build(logger); } catch (ParseException e) { throw UserException .dataReadError(e) .addContext("Date Format String does not match field value.") .addContext("Column", getName()) .addContext("Position", getIndex()) .addContext("Format String", getFormat()) .addContext("Value", value) .build(logger); } } }
@Override protected void readField(long recordsToReadInThisPass) { this.bytebuf = pageReader.pageData; if (usingDictionary) { for (int i = 0; i < recordsToReadInThisPass; i++) { Binary binaryTimeStampValue = pageReader.dictionaryValueReader.readBytes(); valueVec.getMutator().setSafe(valuesReadInCurrentPass + i, getDateTimeValueFromBinary(binaryTimeStampValue, true)); } } else { for (int i = 0; i < recordsToReadInThisPass; i++) { Binary binaryTimeStampValue = pageReader.valueReader.readBytes(); valueVec.getMutator().setSafe(valuesReadInCurrentPass + i, getDateTimeValueFromBinary(binaryTimeStampValue, true)); } } // The width of each element of the TimeStampVector is 8 bytes (64 bits) instead of 12 bytes. dataTypeLengthInBits = NullableTimeStampHolder.WIDTH * 8; } }
@Override public boolean allocateNewSafe() { /* Boolean to keep track if all the memory allocations were successful * Used in the case of composite vectors when we need to allocate multiple * buffers for multiple vectors. If one of the allocations failed we need to * clear all the memory that we allocated */ boolean success = false; try { success = values.allocateNewSafe() && bits.allocateNewSafe(); } finally { if (!success) { clear(); } } bits.zeroVector(); mutator.reset(); accessor.reset(); return success; }
public void writeTimeStamp(long value) { mutator.setSafe(idx(), 1, value); vector.getMutator().setValueCount(idx() + 1); }
public void setSafe(int index, NullableTimeStampHolder holder) { setType(index, MinorType.TIMESTAMP); getTimeStampVector().getMutator().setSafe(index, holder); }
public void writeNull() { mutator.setNull(idx()); vector.getMutator().setValueCount(idx() + 1); }
public void write(NullableTimeStampHolder h) { mutator.setSafe(idx(), h); vector.getMutator().setValueCount(idx()+1); }
private void setTimestampColumnValue(final long data, final ProjectedColumnInfo pci, final int count) { ((NullableTimeStampVector.Mutator) pci.vv.getMutator()) .setSafe(count, data); }
@Override public void allocateNew(int valueCount) { try { values.allocateNew(valueCount); bits.allocateNew(valueCount); } catch(OutOfMemoryException e) { clear(); throw e; } bits.zeroVector(); mutator.reset(); accessor.reset(); }
@Override public void toNullable(ValueVector nullableVector) { NullableTimeStampVector dest = (NullableTimeStampVector) nullableVector; dest.getMutator().fromNotNullable(this); }
public void copyFrom(int fromIndex, int thisIndex, NullableTimeStampVector from){ final Accessor fromAccessor = from.getAccessor(); if (!fromAccessor.isNull(fromIndex)) { mutator.set(thisIndex, fromAccessor.get(fromIndex)); } }
public void write(TimeStampHolder h) { mutator.setSafe(idx(), h); vector.getMutator().setValueCount(idx()+1); }
@Override protected void readField(long recordsToReadInThisPass) { if (usingDictionary) { for (int i = 0; i < recordsToReadInThisPass; i++){ valueVec.getMutator().setSafe(valuesReadInCurrentPass + i, pageReader.dictionaryValueReader.readLong()); } } else { for (int i = 0; i < recordsToReadInThisPass; i++){ valueVec.getMutator().setSafe(valuesReadInCurrentPass + i, pageReader.valueReader.readLong()); } } } }
@Override public void reset() { bits.zeroVector(); mutator.reset(); accessor.reset(); super.reset(); }
@Override public void exchange(ValueVector other) { NullableTimeStampVector target = (NullableTimeStampVector) other; bits.exchange(target.bits); values.exchange(target.values); mutator.exchange(other.getMutator()); }
@Override public void writeField(Object value, int outboundIndex) { if (value != null) { vector.getMutator().setSafe(outboundIndex, ((Timestamp) value).getTime()); } } }
if (pci.kuduColumn.isNullable()) { ((NullableTimeStampVector.Mutator) pci.vv.getMutator()) .setSafe(rowIndex, result.getLong(pci.index) / 1000); } else { ((TimeStampVector.Mutator) pci.vv.getMutator())
@Override public boolean allocateNewSafe() { /* Boolean to keep track if all the memory allocations were successful * Used in the case of composite vectors when we need to allocate multiple * buffers for multiple vectors. If one of the allocations failed we need to * clear all the memory that we allocated */ boolean success = false; try { success = values.allocateNewSafe() && bits.allocateNewSafe(); } finally { if (!success) { clear(); } } bits.zeroVector(); mutator.reset(); accessor.reset(); return success; }