public static void writeDateToByteStream(RandomAccessOutput byteStream, DateWritableV2 date) { LazyBinaryUtils.writeVInt(byteStream, date.getDays()); }
public void set(DateWritableV2 d) { set(d.getDays()); }
@Override public void assignObjectValue(Object val, int destIndex) throws HiveException { if (val == null) { assignNull(destIndex); } else { DateWritableV2 bw = (DateWritableV2) val; assignLong(bw.getDays(), destIndex); } } }.init(outputBatch, (LongColumnVector) destCol);
private Date readDateValue(String dateStr) { // try either yyyy-mm-dd, or integer representing days since epoch try { DateWritableV2 writableVal = new DateWritableV2(org.apache.hadoop.hive.common.type.Date.valueOf(dateStr)); return new Date(writableVal.getDays()); } catch (IllegalArgumentException err) { // Fallback to integer parsing LOG.debug("Reading date value as days since epoch: {}", dateStr); return new Date(Long.parseLong(dateStr)); } } }
@Override protected void update(Object p, PrimitiveObjectInspector inputOI) { // DateWritableV2 is mutable, DateStatsAgg needs its own copy DateWritableV2 v = new DateWritableV2((DateWritableV2) inputOI.getPrimitiveWritableObject(p)); //Update min counter if new value is less than min seen so far if (min == null || v.compareTo(min) < 0) { min = v; } //Update max counter if new value is greater than max seen so far if (max == null || v.compareTo(max) > 0) { max = v; } // Add value to NumDistinctValue Estimator numDV.addToEstimator(v.getDays()); }
private static void unpackDateStats(ObjectInspector oi, Object o, String fName, ColumnStatisticsObj statsObj) { if (fName.equals("countnulls")) { long v = ((LongObjectInspector) oi).get(o); statsObj.getStatsData().getDateStats().setNumNulls(v); } else if (fName.equals("numdistinctvalues")) { long v = ((LongObjectInspector) oi).get(o); statsObj.getStatsData().getDateStats().setNumDVs(v); } else if (fName.equals("max")) { DateWritableV2 v = ((DateObjectInspector) oi).getPrimitiveWritableObject(o); statsObj.getStatsData().getDateStats().setHighValue(new Date(v.getDays())); } else if (fName.equals("min")) { DateWritableV2 v = ((DateObjectInspector) oi).getPrimitiveWritableObject(o); statsObj.getStatsData().getDateStats().setLowValue(new Date(v.getDays())); } else if (fName.equals("ndvbitvector")) { PrimitiveObjectInspector poi = (PrimitiveObjectInspector) oi; byte[] buf = ((BinaryObjectInspector) poi).getPrimitiveJavaObject(o); statsObj.getStatsData().getDateStats().setBitVectors(buf); ; } }
byteBuffer.putInt(((DateObjectInspector) poi).getPrimitiveWritableObject(o).getDays()); return Murmur3.hash32(byteBuffer.array(), 4); case TIMESTAMP: {
} else { ((LongColumnVector) columnVector).vector[batchIndex] = ((DateWritableV2) object).getDays();
LongColumnVector vector = (LongColumnVector) column; vector.vector[rowId] = ((DateObjectInspector) inspector) .getPrimitiveWritableObject(obj).getDays(); break;
DateWritableV2 vDate = ((DateObjectInspector)inputOI). getPrimitiveWritableObject(parameters[0]); bf.addLong(vDate.getDays()); break; case TIMESTAMP:
int v = doi.getPrimitiveWritableObject(o).getDays(); serializeInt(buffer, v, invert); return;
dateWritable.getDays();
DateWritableV2 vDate = ((DateObjectInspector) valObjectInspector). getPrimitiveWritableObject(arguments[0].get()); return bloomFilter.testLong(vDate.getDays()); case TIMESTAMP: Timestamp vTimeStamp = ((TimestampObjectInspector) valObjectInspector).
LongColumnVector lcv = (LongColumnVector) batch.cols[offset + colIndex]; if (writableCol != null) { lcv.vector[rowIndex] = ((DateWritableV2) writableCol).getDays(); lcv.isNull[rowIndex] = false; } else {
break; case DATE: ((LongColumnVector) colVector).vector[batchIndex] = deserializeRead.currentDateWritable.getDays(); break; case FLOAT:
public static void writeDateToByteStream(RandomAccessOutput byteStream, DateWritableV2 date) { LazyBinaryUtils.writeVInt(byteStream, date.getDays()); }
public void set(DateWritableV2 d) { set(d.getDays()); }
byteBuffer.putInt(((DateObjectInspector) poi).getPrimitiveWritableObject(o).getDays()); return Murmur3.hash32(byteBuffer.array(), 4); case TIMESTAMP: {
int v = doi.getPrimitiveWritableObject(o).getDays(); serializeInt(buffer, v, invert); return;