use of org.apache.druid.data.input.InputRow in project druid by druid-io.
the class RangePartitionIndexTaskInputRowIteratorBuilderTest method doesNotInvokeHandlersIfRowValidNull.
@Test
public void doesNotInvokeHandlersIfRowValidNull() {
DateTime timestamp = IndexTaskInputRowIteratorBuilderTestingFactory.TIMESTAMP;
List<String> nullDimensionValue = null;
InputRow inputRow = IndexTaskInputRowIteratorBuilderTestingFactory.createInputRow(timestamp, nullDimensionValue);
CloseableIterator<InputRow> inputRowIterator = IndexTaskInputRowIteratorBuilderTestingFactory.createInputRowIterator(inputRow);
GranularitySpec granularitySpec = IndexTaskInputRowIteratorBuilderTestingFactory.createGranularitySpec(timestamp, IndexTaskInputRowIteratorBuilderTestingFactory.PRESENT_BUCKET_INTERVAL_OPT);
IndexTaskInputRowIteratorBuilderTestingFactory.HandlerTester handlerTester = IndexTaskInputRowIteratorBuilderTestingFactory.createHandlerTester(() -> new RangePartitionIndexTaskInputRowIteratorBuilder(IndexTaskInputRowIteratorBuilderTestingFactory.DIMENSIONS, !SKIP_NULL));
List<IndexTaskInputRowIteratorBuilderTestingFactory.HandlerTester.Handler> handlerInvocationHistory = handlerTester.invokeHandlers(inputRowIterator, granularitySpec, inputRow);
Assert.assertEquals(Collections.emptyList(), handlerInvocationHistory);
}
use of org.apache.druid.data.input.InputRow in project druid by druid-io.
the class RangePartitionIndexTaskInputRowIteratorBuilderTest method invokesHandlerIfRowInvalidNull.
@Test
public void invokesHandlerIfRowInvalidNull() {
DateTime timestamp = IndexTaskInputRowIteratorBuilderTestingFactory.TIMESTAMP;
List<String> nullDimensionValue = null;
InputRow inputRow = IndexTaskInputRowIteratorBuilderTestingFactory.createInputRow(timestamp, nullDimensionValue);
CloseableIterator<InputRow> inputRowIterator = IndexTaskInputRowIteratorBuilderTestingFactory.createInputRowIterator(inputRow);
GranularitySpec granularitySpec = IndexTaskInputRowIteratorBuilderTestingFactory.createGranularitySpec(timestamp, IndexTaskInputRowIteratorBuilderTestingFactory.PRESENT_BUCKET_INTERVAL_OPT);
List<IndexTaskInputRowIteratorBuilderTestingFactory.HandlerTester.Handler> handlerInvocationHistory = HANDLER_TESTER.invokeHandlers(inputRowIterator, granularitySpec, NO_NEXT_INPUT_ROW);
assertNotInHandlerInvocationHistory(handlerInvocationHistory, IndexTaskInputRowIteratorBuilderTestingFactory.HandlerTester.Handler.NULL_ROW);
assertNotInHandlerInvocationHistory(handlerInvocationHistory, IndexTaskInputRowIteratorBuilderTestingFactory.HandlerTester.Handler.ABSENT_BUCKET_INTERVAL);
}
use of org.apache.druid.data.input.InputRow in project druid by druid-io.
the class RangePartitionCachingLocalSegmentAllocatorTest method failsIfAllocateFromEmptyInterval.
@Test
public void failsIfAllocateFromEmptyInterval() {
Interval interval = INTERVAL_EMPTY;
InputRow row = createInputRow(interval, PARTITION9);
exception.expect(IllegalStateException.class);
exception.expectMessage("Failed to get shardSpec");
String sequenceName = sequenceNameFunction.getSequenceName(interval, row);
allocate(row, sequenceName);
}
use of org.apache.druid.data.input.InputRow in project druid by druid-io.
the class RangePartitionCachingLocalSegmentAllocatorTest method getSequenceName.
@Test
public void getSequenceName() {
// getSequenceName_forIntervalAndRow_shouldUseISOFormatAndPartitionNumForRow
Interval interval = INTERVAL_NORMAL;
InputRow row = createInputRow(interval, PARTITION9);
String sequenceName = sequenceNameFunction.getSequenceName(interval, row);
String expectedSequenceName = StringUtils.format("%s_%s_%d", TASKID, interval, 1);
Assert.assertEquals(expectedSequenceName, sequenceName);
}
use of org.apache.druid.data.input.InputRow in project druid by druid-io.
the class RangePartitionCachingLocalSegmentAllocatorTest method allocatesCorrectShardSpecsForFirstPartition.
@Test
public void allocatesCorrectShardSpecsForFirstPartition() {
Interval interval = INTERVAL_NORMAL;
InputRow row = createInputRow(interval, PARTITION0);
testAllocate(row, interval, 0);
}
Aggregations