@Override public Object writeValue(long value) { DateUtils.setIntervalDayTimeTotalNanos(interval, value); ((SettableHiveIntervalDayTimeObjectInspector) this.objectInspector).set(obj, interval); return obj; }
@Override Object extract(int batchIndex) { int adjustedIndex = (colVector.isRepeating ? 0 : batchIndex); if (colVector.noNulls || !colVector.isNull[adjustedIndex]) { long value = vector[adjustedIndex]; DateUtils.setIntervalDayTimeTotalNanos(hiveIntervalDayTime, value); PrimitiveObjectInspectorFactory.writableHiveIntervalDayTimeObjectInspector.set(object, hiveIntervalDayTime); return object; } else { return null; } } }
@Override public Object setValue(Object field, long value) { if (null == field) { field = initValue(null); } DateUtils.setIntervalDayTimeTotalNanos(interval, value); ((SettableHiveIntervalDayTimeObjectInspector) this.objectInspector).set(field, interval); return field; }
@Override public void writeHiveIntervalDayTime(long totalNanos) throws IOException { if (index > 0) { output.write(separator); } if (hiveIntervalDayTime == null) { hiveIntervalDayTime = new HiveIntervalDayTime(); } if (hiveIntervalDayTimeWritable == null) { hiveIntervalDayTimeWritable = new HiveIntervalDayTimeWritable(); } DateUtils.setIntervalDayTimeTotalNanos(hiveIntervalDayTime, totalNanos); hiveIntervalDayTimeWritable.set(hiveIntervalDayTime); LazyHiveIntervalDayTime.writeUTF8(output, hiveIntervalDayTimeWritable); index++; }
@Override public void writeHiveIntervalDayTime(long totalNanos) throws IOException { if (index > 0) { output.write(separator); } if (hiveIntervalDayTime == null) { hiveIntervalDayTime = new HiveIntervalDayTime(); } if (hiveIntervalDayTimeWritable == null) { hiveIntervalDayTimeWritable = new HiveIntervalDayTimeWritable(); } DateUtils.setIntervalDayTimeTotalNanos(hiveIntervalDayTime, totalNanos); hiveIntervalDayTimeWritable.set(hiveIntervalDayTime); LazyHiveIntervalDayTime.writeUTF8(output, hiveIntervalDayTimeWritable); index++; }
@Override public void writeHiveIntervalDayTime(long totalNanos) throws IOException { if (index > 0) { output.write(separator); } if (hiveIntervalDayTime == null) { hiveIntervalDayTime = new HiveIntervalDayTime(); } if (hiveIntervalDayTimeWritable == null) { hiveIntervalDayTimeWritable = new HiveIntervalDayTimeWritable(); } DateUtils.setIntervalDayTimeTotalNanos(hiveIntervalDayTime, totalNanos); hiveIntervalDayTimeWritable.set(hiveIntervalDayTime); LazyHiveIntervalDayTime.writeUTF8(output, hiveIntervalDayTimeWritable); index++; }
@Override public void writeHiveIntervalDayTime(long totalNanos) throws IOException { // Every 8 fields we write a NULL byte. if ((fieldIndex % 8) == 0) { if (fieldIndex > 0) { // Write back previous 8 field's NULL byte. output.writeByte(nullOffset, nullByte); nullByte = 0; nullOffset = output.getLength(); } // Allocate next NULL byte. output.reserve(1); } // Set bit in NULL byte when a field is NOT NULL. nullByte |= 1 << (fieldIndex % 8); if (hiveIntervalDayTime == null) { hiveIntervalDayTime = new HiveIntervalDayTime(); } if (hiveIntervalDayTimeWritable == null) { hiveIntervalDayTimeWritable = new HiveIntervalDayTimeWritable(); } DateUtils.setIntervalDayTimeTotalNanos(hiveIntervalDayTime, totalNanos); hiveIntervalDayTimeWritable.set(hiveIntervalDayTime); hiveIntervalDayTimeWritable.writeToByteStream(output); fieldIndex++; if (fieldIndex == fieldCount) { // Write back the final NULL byte before the last fields. output.writeByte(nullOffset, nullByte); } }
@Override public void writeHiveIntervalDayTime(long totalNanos) throws IOException { // Every 8 fields we write a NULL byte. if ((fieldIndex % 8) == 0) { if (fieldIndex > 0) { // Write back previous 8 field's NULL byte. output.writeByte(nullOffset, nullByte); nullByte = 0; nullOffset = output.getLength(); } // Allocate next NULL byte. output.reserve(1); } // Set bit in NULL byte when a field is NOT NULL. nullByte |= 1 << (fieldIndex % 8); if (hiveIntervalDayTime == null) { hiveIntervalDayTime = new HiveIntervalDayTime(); } if (hiveIntervalDayTimeWritable == null) { hiveIntervalDayTimeWritable = new HiveIntervalDayTimeWritable(); } DateUtils.setIntervalDayTimeTotalNanos(hiveIntervalDayTime, totalNanos); hiveIntervalDayTimeWritable.set(hiveIntervalDayTime); hiveIntervalDayTimeWritable.writeToByteStream(output); fieldIndex++; if (fieldIndex == fieldCount) { // Write back the final NULL byte before the last fields. output.writeByte(nullOffset, nullByte); } }
@Override public void writeHiveIntervalDayTime(long totalNanos) throws IOException { // Every 8 fields we write a NULL byte. if ((fieldIndex % 8) == 0) { if (fieldIndex > 0) { // Write back previous 8 field's NULL byte. output.writeByte(nullOffset, nullByte); nullByte = 0; nullOffset = output.getLength(); } // Allocate next NULL byte. output.reserve(1); } // Set bit in NULL byte when a field is NOT NULL. nullByte |= 1 << (fieldIndex % 8); if (hiveIntervalDayTime == null) { hiveIntervalDayTime = new HiveIntervalDayTime(); } if (hiveIntervalDayTimeWritable == null) { hiveIntervalDayTimeWritable = new HiveIntervalDayTimeWritable(); } DateUtils.setIntervalDayTimeTotalNanos(hiveIntervalDayTime, totalNanos); hiveIntervalDayTimeWritable.set(hiveIntervalDayTime); hiveIntervalDayTimeWritable.writeToByteStream(output); fieldIndex++; if (fieldIndex == fieldCount) { // Write back the final NULL byte before the last fields. output.writeByte(nullOffset, nullByte); } }