htran1 commented on a change in pull request #2630: [GOBBLIN-767] Support different time units in TimeBasedWriterPartitioner URL: https://github.com/apache/incubator-gobblin/pull/2630#discussion_r282967242
########## File path: gobblin-core/src/test/java/org/apache/gobblin/writer/partitioner/TimeBasedAvroWriterPartitionerTest.java ########## @@ -108,23 +114,31 @@ public void testWriter() throws IOException { // Write three records, each should be written to a different file GenericRecordBuilder genericRecordBuilder = new GenericRecordBuilder(this.schema); + State state = getBasicState(); + DataWriter<GenericRecord> millisPartitionWriter = getWriter(state); + // This timestamp corresponds to 2015/01/01 genericRecordBuilder.set("timestamp", 1420099200000l); - this.writer.writeEnvelope(new RecordEnvelope<>(genericRecordBuilder.build())); + millisPartitionWriter.writeEnvelope(new RecordEnvelope<>(genericRecordBuilder.build())); // This timestamp corresponds to 2015/01/02 genericRecordBuilder.set("timestamp", 1420185600000l); - this.writer.writeEnvelope(new RecordEnvelope<>(genericRecordBuilder.build())); - - // This timestamp corresponds to 2015/01/03 - genericRecordBuilder.set("timestamp", 1420272000000l); - this.writer.writeEnvelope(new RecordEnvelope<>(genericRecordBuilder.build())); + millisPartitionWriter.writeEnvelope(new RecordEnvelope<>(genericRecordBuilder.build())); + millisPartitionWriter.close(); + millisPartitionWriter.commit(); // Check that the writer reports that 3 records have been written - Assert.assertEquals(this.writer.recordsWritten(), 3); + Assert.assertEquals(millisPartitionWriter.recordsWritten(), 2); - this.writer.close(); - this.writer.commit(); + state.setProp(TimeBasedWriterPartitioner.WRITER_PARTITION_TIMEUNIT, "seconds"); + DataWriter<GenericRecord> secsPartitionWriter = getWriter(state); + // This timestamp corresponds to 2015/01/03 + genericRecordBuilder.set("timestamp", 1420272000L); + secsPartitionWriter.writeEnvelope(new RecordEnvelope<>(genericRecordBuilder.build())); + secsPartitionWriter.close(); + secsPartitionWriter.commit(); + // Check that the writer reports that 3 records have been written Review comment: Mismatch between comment and code here too. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services