@Test public void testGetRecordTimestamp() { State state = getBasicState(); TimeBasedAvroWriterPartitioner partitioner = new TimeBasedAvroWriterPartitioner(state); GenericRecordBuilder genericRecordBuilder = new GenericRecordBuilder(getRecordSchema("string")); genericRecordBuilder.set("timestamp", "1557786583000"); Assert.assertTrue(partitioner.getRecordTimestamp(genericRecordBuilder.build()) > 1557786583000L); state.setProp(TimeBasedAvroWriterPartitioner.WRITER_PARTITION_ENABLE_PARSE_AS_STRING, true); partitioner = new TimeBasedAvroWriterPartitioner(state); Assert.assertEquals(partitioner.getRecordTimestamp(genericRecordBuilder.build()), 1557786583000L); genericRecordBuilder.set("timestamp", new Utf8("1557786583000")); Assert.assertEquals(partitioner.getRecordTimestamp(genericRecordBuilder.build()), 1557786583000L); genericRecordBuilder.set("timestamp", null); Assert.assertTrue( partitioner.getRecordTimestamp(genericRecordBuilder.build()) <= System.currentTimeMillis()); state.setProp(TimeBasedWriterPartitioner.WRITER_PARTITION_TIMEUNIT, "seconds"); partitioner = new TimeBasedAvroWriterPartitioner(state); genericRecordBuilder.set("timestamp", "1557786583"); Assert.assertEquals(partitioner.getRecordTimestamp(genericRecordBuilder.build()), 1557786583L); }
@Override public long getRecordTimestamp(GenericRecord record) { return getRecordTimestamp(getWriterPartitionColumnValue(record)); }
TimeBasedAvroWriterPartitioner extends TimeBasedWriterPartitioner<GenericRecord> { @Override public long getRecordTimestamp(GenericRecord record) { return getRecordTimestamp(getWriterPartitionColumnValue(record)); } }
TimeBasedAvroWriterPartitioner extends TimeBasedWriterPartitioner<GenericRecord> { @Override public long getRecordTimestamp(GenericRecord record) { return getRecordTimestamp(getWriterPartitionColumnValue(record)); } TimeBasedAvroWriterPartitioner(State state);  TimeBasedAvroWriterPartitioner(State state, int numBranches, int branchId); }
TimeBasedAvroWriterPartitioner extends TimeBasedWriterPartitioner<GenericRecord> { @Override public long getRecordTimestamp(GenericRecord record) { return getRecordTimestamp(getWriterPartitionColumnValue(record)); } TimeBasedAvroWriterPartitioner(State state);  TimeBasedAvroWriterPartitioner(State state, int numBranches, int branchId); @Override long getRecordTimestamp(GenericRecord record); }
TimeBasedAvroWriterPartitioner extends TimeBasedWriterPartitioner<GenericRecord> { @Override public long getRecordTimestamp(GenericRecord record) { return getRecordTimestamp(getWriterPartitionColumnValue(record)); } TimeBasedAvroWriterPartitioner(State state);  TimeBasedAvroWriterPartitioner(State state, int numBranches, int branchId); @Override long getRecordTimestamp(GenericRecord record); static final String WRITER_PARTITION_COLUMNS; static final String WRITER_PARTITION_ENABLE_PARSE_AS_STRING; }