use of io.druid.indexer.partitions.PartitionsSpec in project druid by druid-io.
the class HadoopIngestionSpecTest method testPartitionsSpecMaxPartitionSize.
@Test
public void testPartitionsSpecMaxPartitionSize() {
final HadoopIngestionSpec schema;
try {
schema = jsonReadWriteRead("{\n" + " \"tuningConfig\": {\n" + " \"type\": \"hadoop\",\n" + " \"partitionsSpec\": {\n" + " \"type\": \"dimension\",\n" + " \"targetPartitionSize\": 100,\n" + " \"maxPartitionSize\" : 200,\n" + " \"partitionDimension\" : \"foo\"\n" + " }\n" + " }\n" + "}", HadoopIngestionSpec.class);
} catch (Exception e) {
throw Throwables.propagate(e);
}
final PartitionsSpec partitionsSpec = schema.getTuningConfig().getPartitionsSpec();
Assert.assertEquals("isDeterminingPartitions", partitionsSpec.isDeterminingPartitions(), true);
Assert.assertEquals("getTargetPartitionSize", partitionsSpec.getTargetPartitionSize(), 100);
Assert.assertEquals("getMaxPartitionSize", partitionsSpec.getMaxPartitionSize(), 200);
Assert.assertTrue("partitionsSpec", partitionsSpec instanceof SingleDimensionPartitionsSpec);
Assert.assertEquals("getPartitionDimension", ((SingleDimensionPartitionsSpec) partitionsSpec).getPartitionDimension(), "foo");
}
use of io.druid.indexer.partitions.PartitionsSpec in project druid by druid-io.
the class HadoopIngestionSpecTest method testPartitionsSpecAutoHashed.
@Test
public void testPartitionsSpecAutoHashed() {
final HadoopIngestionSpec schema;
try {
schema = jsonReadWriteRead("{\n" + " \"tuningConfig\": {\n" + " \"type\": \"hadoop\",\n" + " \"partitionsSpec\": {\n" + " \"targetPartitionSize\": 100\n" + " }\n" + " }\n" + "}", HadoopIngestionSpec.class);
} catch (Exception e) {
throw Throwables.propagate(e);
}
final PartitionsSpec partitionsSpec = schema.getTuningConfig().getPartitionsSpec();
Assert.assertEquals("isDeterminingPartitions", partitionsSpec.isDeterminingPartitions(), true);
Assert.assertEquals("getTargetPartitionSize", partitionsSpec.getTargetPartitionSize(), 100);
Assert.assertTrue("partitionSpec", partitionsSpec instanceof HashedPartitionsSpec);
}
Aggregations