use of org.apache.druid.data.input.impl.NoopInputRowParser in project druid by druid-io.
the class StringColumnAggregationTest method setup.
@Before
public void setup() throws Exception {
List<String> dimensions = ImmutableList.of(singleValue, multiValue);
List<InputRow> inputRows = new ArrayList<>(n);
for (int i = 1; i <= n; i++) {
String val = String.valueOf(i * 1.0d);
inputRows.add(new MapBasedInputRow(DateTime.now(DateTimeZone.UTC), dimensions, ImmutableMap.of(singleValue, val, multiValue, Lists.newArrayList(val, null, val))));
}
aggregationTestHelper = AggregationTestHelper.createGroupByQueryAggregationTestHelper(Collections.emptyList(), new GroupByQueryConfig(), tempFolder);
IncrementalIndex index = AggregationTestHelper.createIncrementalIndex(inputRows.iterator(), new NoopInputRowParser(null), new AggregatorFactory[] { new CountAggregatorFactory("count") }, 0, Granularities.NONE, false, 100, false);
this.segments = ImmutableList.of(new IncrementalIndexSegment(index, SegmentId.dummy("test")), aggregationTestHelper.persistIncrementalIndex(index, null));
// we have ingested arithmetic progression from 1 to 10, so sums can be computed using following
// All sum values are multiplied by 2 because we are running query on duplicated segment twice.
numRows = 2 * n;
singleValueSum = n * (n + 1);
multiValueSum = 2 * n * (n + 1);
singleValueMax = n;
multiValueMax = n;
singleValueMin = 1;
multiValueMin = 1;
}
use of org.apache.druid.data.input.impl.NoopInputRowParser 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);
}
}
Aggregations