use of org.apache.druid.data.input.InputRow in project druid by druid-io.
the class SimpleTestIndex method makeRealtimeIndex.
private static IncrementalIndex makeRealtimeIndex() {
try {
List<InputRow> inputRows = Lists.newArrayListWithExpectedSize(NUM_ROWS);
for (int i = 1; i <= NUM_ROWS; i++) {
double doubleVal = i + 0.7d;
String stringVal = String.valueOf(doubleVal);
inputRows.add(new MapBasedInputRow(DateTime.now(DateTimeZone.UTC), DIMENSIONS, ImmutableMap.of(DOUBLE_COL, doubleVal, SINGLE_VALUE_DOUBLE_AS_STRING_DIM, stringVal, MULTI_VALUE_DOUBLE_AS_STRING_DIM, Lists.newArrayList(stringVal, null, stringVal))));
}
return AggregationTestHelper.createIncrementalIndex(inputRows.iterator(), new NoopInputRowParser(null), new AggregatorFactory[] { new CountAggregatorFactory("count"), new DoubleSumAggregatorFactory(DOUBLE_COL, DOUBLE_COL) }, 0, Granularities.NONE, false, 100, false);
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
use of org.apache.druid.data.input.InputRow in project druid by druid-io.
the class DataGeneratorTest method testZipf.
@Test
public void testZipf() {
List<GeneratorColumnSchema> schemas = new ArrayList<>();
RowValueTracker tracker = new RowValueTracker();
schemas.add(GeneratorColumnSchema.makeZipf("dimA", ValueType.STRING, false, 1, null, 1000, 2000, 1.0));
schemas.add(GeneratorColumnSchema.makeZipf("dimB", ValueType.FLOAT, false, 1, null, 99990, 99999, 1.0));
schemas.add(GeneratorColumnSchema.makeEnumeratedZipf("dimC", ValueType.STRING, false, 1, null, Arrays.asList("1-Hello", "2-World", "3-Foo", "4-Bar", "5-BA5EBA11", "6-Rocky", "7-Mango", "8-Contango"), 1.0));
DataGenerator dataGenerator = new DataGenerator(schemas, 9999, 0, 0, 1000.0);
for (int i = 0; i < 100; i++) {
InputRow row = dataGenerator.nextRow();
// System.out.println("Z-ROW: " + row);
tracker.addRow(row);
}
tracker.printStuff();
}
use of org.apache.druid.data.input.InputRow in project druid by druid-io.
the class DataGeneratorTest method testRoundedNormal.
@Test
public void testRoundedNormal() {
List<GeneratorColumnSchema> schemas = new ArrayList<>();
RowValueTracker tracker = new RowValueTracker();
schemas.add(GeneratorColumnSchema.makeNormal("dimA", ValueType.FLOAT, false, 1, null, 50.0, 1.0, true));
schemas.add(GeneratorColumnSchema.makeNormal("dimB", ValueType.STRING, false, 1, null, 1000.0, 10.0, true));
DataGenerator dataGenerator = new DataGenerator(schemas, 9999, 0, 0, 1000.0);
for (int i = 0; i < 1000000; i++) {
InputRow row = dataGenerator.nextRow();
// System.out.println("N-ROW: " + row);
tracker.addRow(row);
}
tracker.printStuff();
}
use of org.apache.druid.data.input.InputRow in project druid by druid-io.
the class DataGeneratorTest method testDiscreteUniform.
@Test
public void testDiscreteUniform() {
List<GeneratorColumnSchema> schemas = new ArrayList<>();
RowValueTracker tracker = new RowValueTracker();
schemas.add(GeneratorColumnSchema.makeDiscreteUniform("dimA", ValueType.STRING, false, 1, null, 10, 20));
schemas.add(GeneratorColumnSchema.makeEnumeratedDiscreteUniform("dimB", ValueType.STRING, false, 4, null, Arrays.asList("Hello", "World", "Foo", "Bar")));
schemas.add(GeneratorColumnSchema.makeDiscreteUniform("dimC", ValueType.STRING, false, 1, 0.50, 10, 20));
schemas.add(GeneratorColumnSchema.makeDiscreteUniform("dimD", ValueType.FLOAT, false, 1, null, 100, 120));
DataGenerator dataGenerator = new DataGenerator(schemas, 9999, 0, 0, 1000.0);
for (int i = 0; i < 100; i++) {
InputRow row = dataGenerator.nextRow();
// System.out.println("U-ROW: " + row);
tracker.addRow(row);
}
tracker.printStuff();
}
use of org.apache.druid.data.input.InputRow in project druid by druid-io.
the class DataGeneratorTest method testLazyZipf.
@Test
public void testLazyZipf() {
List<GeneratorColumnSchema> schemas = new ArrayList<>();
RowValueTracker tracker = new RowValueTracker();
schemas.add(GeneratorColumnSchema.makeLazyZipf("dimA", ValueType.STRING, false, 1, null, 0, 1220000, 1.0));
schemas.add(GeneratorColumnSchema.makeLazyZipf("dimB", ValueType.FLOAT, false, 1, null, 99990, 99999, 1.0));
schemas.add(GeneratorColumnSchema.makeLazyZipf("dimC", ValueType.DOUBLE, false, 1, null, 0, 100000, 1.5));
schemas.add(GeneratorColumnSchema.makeLazyZipf("dimD", ValueType.LONG, false, 1, null, 0, 100000, 1.5));
DataGenerator dataGenerator = new DataGenerator(schemas, 9999, 0, 0, 1000.0);
for (int i = 0; i < 100000; i++) {
InputRow row = dataGenerator.nextRow();
System.out.println("Z-ROW: " + row);
tracker.addRow(row);
}
tracker.printStuff();
}
Aggregations