Search in sources :

Example 86 with InputRow

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);
}
Also used : GranularitySpec(org.apache.druid.segment.indexing.granularity.GranularitySpec) InputRow(org.apache.druid.data.input.InputRow) DateTime(org.joda.time.DateTime) Test(org.junit.Test)

Example 87 with InputRow

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);
}
Also used : GranularitySpec(org.apache.druid.segment.indexing.granularity.GranularitySpec) InputRow(org.apache.druid.data.input.InputRow) DateTime(org.joda.time.DateTime) Test(org.junit.Test)

Example 88 with InputRow

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);
}
Also used : InputRow(org.apache.druid.data.input.InputRow) Interval(org.joda.time.Interval) Test(org.junit.Test)

Example 89 with InputRow

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);
}
Also used : InputRow(org.apache.druid.data.input.InputRow) Interval(org.joda.time.Interval) Test(org.junit.Test)

Example 90 with InputRow

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);
}
Also used : InputRow(org.apache.druid.data.input.InputRow) Interval(org.joda.time.Interval) Test(org.junit.Test)

Aggregations

InputRow (org.apache.druid.data.input.InputRow)266 Test (org.junit.Test)193 MapBasedInputRow (org.apache.druid.data.input.MapBasedInputRow)57 InputEntityReader (org.apache.druid.data.input.InputEntityReader)54 InputRowSchema (org.apache.druid.data.input.InputRowSchema)52 DimensionsSpec (org.apache.druid.data.input.impl.DimensionsSpec)52 TimestampSpec (org.apache.druid.data.input.impl.TimestampSpec)49 ArrayList (java.util.ArrayList)46 List (java.util.List)37 ImmutableList (com.google.common.collect.ImmutableList)33 JSONPathSpec (org.apache.druid.java.util.common.parsers.JSONPathSpec)33 InitializedNullHandlingTest (org.apache.druid.testing.InitializedNullHandlingTest)33 InputRowListPlusRawValues (org.apache.druid.data.input.InputRowListPlusRawValues)29 File (java.io.File)27 HadoopDruidIndexerConfig (org.apache.druid.indexer.HadoopDruidIndexerConfig)27 JSONPathFieldSpec (org.apache.druid.java.util.common.parsers.JSONPathFieldSpec)27 DateTime (org.joda.time.DateTime)24 Map (java.util.Map)23 IOException (java.io.IOException)18 Interval (org.joda.time.Interval)18