### Question:
BinaryRow extends BinaryFormat implements BaseRow { @Override public <T> BinaryGeneric<T> getGeneric(int pos) { assertIndexIsValid(pos); return BinaryGeneric.readBinaryGenericFieldFromSegments(segments, offset, getLong(pos)); } BinaryRow(int arity); static int calculateBitSetWidthInBytes(int arity); static int calculateFixPartSizeInBytes(int arity); static boolean isInFixedLengthPart(LogicalType type); static boolean isMutable(LogicalType type); int getFixedLengthPartSize(); @Override int getArity(); @Override byte getHeader(); @Override void setHeader(byte header); void setTotalSize(int sizeInBytes); @Override boolean isNullAt(int pos); @Override void setNullAt(int i); @Override void setInt(int pos, int value); @Override void setLong(int pos, long value); @Override void setDouble(int pos, double value); @Override void setDecimal(int pos, Decimal value, int precision); @Override void setBoolean(int pos, boolean value); @Override void setShort(int pos, short value); @Override void setByte(int pos, byte value); @Override void setFloat(int pos, float value); @Override boolean getBoolean(int pos); @Override byte getByte(int pos); @Override short getShort(int pos); @Override int getInt(int pos); @Override long getLong(int pos); @Override float getFloat(int pos); @Override double getDouble(int pos); @Override BinaryString getString(int pos); @Override Decimal getDecimal(int pos, int precision, int scale); @Override BinaryGeneric<T> getGeneric(int pos); @Override byte[] getBinary(int pos); @Override BaseArray getArray(int pos); @Override BaseMap getMap(int pos); @Override BaseRow getRow(int pos, int numFields); boolean anyNull(); boolean anyNull(int[] fields); BinaryRow copy(); BinaryRow copy(BinaryRow reuse); void clear(); @Override int hashCode(); String toOriginString(LogicalType... types); static String toOriginString(BaseRow row, LogicalType[] types); boolean equalsWithoutHeader(BaseRow o); static final boolean LITTLE_ENDIAN; static final int HEADER_SIZE_IN_BITS; }### Answer:
@Test public void testDateAndTimeAsGenericObject() { BinaryRow row = new BinaryRow(7); BinaryRowWriter writer = new BinaryRowWriter(row); LocalDate localDate = LocalDate.of(2019, 7, 16); LocalTime localTime = LocalTime.of(17, 31); LocalDateTime localDateTime = LocalDateTime.of(localDate, localTime); writer.writeInt(0, 0); writer.writeGeneric(1, new BinaryGeneric<>(new Date(123), SqlDateSerializer.INSTANCE)); writer.writeGeneric(2, new BinaryGeneric<>(new Time(456), SqlTimeSerializer.INSTANCE)); writer.writeGeneric(3, new BinaryGeneric<>(new Timestamp(789), SqlTimestampSerializer.INSTANCE)); writer.writeGeneric(4, new BinaryGeneric<>(localDate, LocalDateSerializer.INSTANCE)); writer.writeGeneric(5, new BinaryGeneric<>(localTime, LocalTimeSerializer.INSTANCE)); writer.writeGeneric(6, new BinaryGeneric<>(localDateTime, LocalDateTimeSerializer.INSTANCE)); writer.complete(); assertEquals(new Date(123), BinaryGeneric.getJavaObjectFromBinaryGeneric( row.getGeneric(1), SqlDateSerializer.INSTANCE)); assertEquals(new Time(456), BinaryGeneric.getJavaObjectFromBinaryGeneric( row.getGeneric(2), SqlTimeSerializer.INSTANCE)); assertEquals(new Timestamp(789), BinaryGeneric.getJavaObjectFromBinaryGeneric( row.getGeneric(3), SqlTimestampSerializer.INSTANCE)); assertEquals(localDate, BinaryGeneric.getJavaObjectFromBinaryGeneric( row.getGeneric(4), LocalDateSerializer.INSTANCE)); assertEquals(localTime, BinaryGeneric.getJavaObjectFromBinaryGeneric( row.getGeneric(5), LocalTimeSerializer.INSTANCE)); assertEquals(localDateTime, BinaryGeneric.getJavaObjectFromBinaryGeneric( row.getGeneric(6), LocalDateTimeSerializer.INSTANCE)); }