private static IncrementalIndex buildIncrementalIndexWithRows( IncrementalIndexSchema schema, int maxRows, Iterable<InputRow> rows ) { Preconditions.checkNotNull(schema, "schema"); final IncrementalIndex incrementalIndex = new IncrementalIndex.Builder() .setIndexSchema(schema) .setMaxRowCount(maxRows) .buildOnheap(); for (InputRow row : rows) { try { incrementalIndex.add(row); } catch (IndexSizeExceededException e) { throw Throwables.propagate(e); } } return incrementalIndex; } }
private static IncrementalIndex newIndex(String minTimeStamp, int maxRowCount) { final IncrementalIndexSchema schema = new IncrementalIndexSchema.Builder() .withMinTimestamp(DateTimes.of(minTimeStamp).getMillis()) .withQueryGranularity(Granularities.HOUR) .withMetrics(TestIndex.METRIC_AGGS) .build(); return new IncrementalIndex.Builder() .setIndexSchema(schema) .setMaxRowCount(maxRowCount) .buildOnheap(); }
@Test public void testgetDimensions() { final IncrementalIndex<Aggregator> incrementalIndex = new IncrementalIndex.Builder() .setIndexSchema( new IncrementalIndexSchema.Builder() .withMetrics(new CountAggregatorFactory("count")) .withDimensionsSpec( new DimensionsSpec( DimensionsSpec.getDefaultSchemas(Arrays.asList("dim0", "dim1")), null, null ) ) .build() ) .setMaxRowCount(1000000) .buildOnheap(); closerRule.closeLater(incrementalIndex); Assert.assertEquals(Arrays.asList("dim0", "dim1"), incrementalIndex.getDimensionNames()); }
private static IncrementalIndex makeIncrementalIndex( Bucket theBucket, AggregatorFactory[] aggs, HadoopDruidIndexerConfig config, Iterable<String> oldDimOrder, Map<String, ColumnCapabilitiesImpl> oldCapabilities ) { final HadoopTuningConfig tuningConfig = config.getSchema().getTuningConfig(); final IncrementalIndexSchema indexSchema = new IncrementalIndexSchema.Builder() .withMinTimestamp(theBucket.time.getMillis()) .withTimestampSpec(config.getSchema().getDataSchema().getParser().getParseSpec().getTimestampSpec()) .withDimensionsSpec(config.getSchema().getDataSchema().getParser()) .withQueryGranularity(config.getSchema().getDataSchema().getGranularitySpec().getQueryGranularity()) .withMetrics(aggs) .withRollup(config.getSchema().getDataSchema().getGranularitySpec().isRollup()) .build(); IncrementalIndex newIndex = new IncrementalIndex.Builder() .setIndexSchema(indexSchema) .setReportParseExceptions(!tuningConfig.isIgnoreInvalidRows()) // only used by OffHeapIncrementalIndex .setMaxRowCount(tuningConfig.getRowFlushBoundary()) .setMaxBytesInMemory(TuningConfigs.getMaxBytesInMemoryOrDefault(tuningConfig.getMaxBytesInMemory())) .buildOnheap(); if (oldDimOrder != null && !indexSchema.getDimensionsSpec().hasCustomDimensions()) { newIndex.loadDimensionIterable(oldDimOrder, oldCapabilities); } return newIndex; }
private IncrementalIndex makeIncIndex(boolean withRollup) { return new IncrementalIndex.Builder() .setIndexSchema( new IncrementalIndexSchema.Builder() .withDimensionsSpec(new DimensionsSpec( Arrays.asList( new StringDimensionSchema("dimA"), new LongDimensionSchema("metA") ), null, null )) .withRollup(withRollup) .build() ) .setReportParseExceptions(false) .setConcurrentEventAdd(true) .setMaxRowCount(1000) .buildOnheap(); }
private IncrementalIndex makeIncIndex(boolean withRollup) { return new IncrementalIndex.Builder() .setIndexSchema( new IncrementalIndexSchema.Builder() .withDimensionsSpec(new DimensionsSpec( Arrays.asList( new StringDimensionSchema("dimA"), new LongDimensionSchema("metA") ), null, null )) .withRollup(withRollup) .build() ) .setReportParseExceptions(false) .setConcurrentEventAdd(true) .setMaxRowCount(1000) .buildOnheap(); }
private IncrementalIndex makeIncIndex(boolean withRollup) { return new IncrementalIndex.Builder() .setIndexSchema( new IncrementalIndexSchema.Builder() .withDimensionsSpec(new DimensionsSpec( Arrays.asList( new StringDimensionSchema("dimA"), new LongDimensionSchema("metA") ), null, null )) .withRollup(withRollup) .build() ) .setReportParseExceptions(false) .setConcurrentEventAdd(true) .setMaxRowCount(1000) .buildOnheap(); }
private IncrementalIndex makeIncIndex() { return new IncrementalIndex.Builder() .setIndexSchema( new IncrementalIndexSchema.Builder() .withDimensionsSpec(new DimensionsSpec( Arrays.asList( new StringDimensionSchema("dimA"), new StringDimensionSchema("dimB"), new LongDimensionSchema("metA"), new LongDimensionSchema("metB") ), null, null )) .build() ) .setReportParseExceptions(false) .setConcurrentEventAdd(true) .setMaxRowCount(1000) .buildOnheap(); }
public static IncrementalIndex createIndex( AggregatorFactory[] aggregatorFactories, DimensionsSpec dimensionsSpec ) { if (null == aggregatorFactories) { aggregatorFactories = defaultAggregatorFactories; } return new IncrementalIndex.Builder() .setIndexSchema( new IncrementalIndexSchema.Builder() .withDimensionsSpec(dimensionsSpec) .withMetrics(aggregatorFactories) .build() ) .setMaxRowCount(1000000) .buildOnheap(); }
private IncrementalIndex makeIncIndex(boolean withRollup) { return new IncrementalIndex.Builder() .setIndexSchema( new IncrementalIndexSchema.Builder() .withMetrics(schemaInfo.getAggsArray()) .withRollup(withRollup) .build() ) .setReportParseExceptions(false) .setConcurrentEventAdd(true) .setMaxRowCount(rowsPerSegment) .buildOnheap(); }
private IncrementalIndex makeIncIndex() { return new IncrementalIndex.Builder() .setIndexSchema( new IncrementalIndexSchema.Builder() .withMetrics(schemaInfo.getAggsArray()) .withRollup(rollup) .build() ) .setReportParseExceptions(false) .setMaxRowCount(rowsPerSegment) .buildOnheap(); }
private IncrementalIndex makeIncIndex() { return new IncrementalIndex.Builder() .setIndexSchema( new IncrementalIndexSchema.Builder() .withMetrics(schemaInfo.getAggsArray()) .withRollup(rollup) .build() ) .setReportParseExceptions(false) .setMaxRowCount(rowsPerSegment) .buildOnheap(); }
private static IncrementalIndex newIndex(String minTimeStamp, int maxRowCount) { final IncrementalIndexSchema schema = new IncrementalIndexSchema.Builder() .withMinTimestamp(DateTimes.of(minTimeStamp).getMillis()) .withQueryGranularity(Granularities.HOUR) .withMetrics(TestIndex.METRIC_AGGS) .build(); return new IncrementalIndex.Builder() .setIndexSchema(schema) .setMaxRowCount(maxRowCount) .buildOnheap(); }
private static IncrementalIndex newIndex(String minTimeStamp, int maxRowCount) { final IncrementalIndexSchema schema = new IncrementalIndexSchema.Builder() .withMinTimestamp(DateTimes.of(minTimeStamp).getMillis()) .withQueryGranularity(Granularities.HOUR) .withMetrics(TestIndex.METRIC_AGGS) .build(); return new IncrementalIndex.Builder() .setIndexSchema(schema) .setMaxRowCount(maxRowCount) .buildOnheap(); }
@Override public IncrementalIndex createIndex() { return new IncrementalIndex.Builder() .setIndexSchema(schema) .setDeserializeComplexMetrics(false) .setSortFacts(sortFacts) .setMaxRowCount(1000) .buildOnheap(); } },
private IncrementalIndex getIndexWithDims(List<String> dims) { IncrementalIndexSchema schema = new IncrementalIndexSchema.Builder() .withDimensionsSpec(new DimensionsSpec(makeDimensionSchemas(dims), null, null)) .withMetrics(new CountAggregatorFactory("count")) .build(); return new IncrementalIndex.Builder() .setIndexSchema(schema) .setMaxRowCount(1000) .buildOnheap(); }
private IncrementalIndex makeIncIndex() { return new IncrementalIndex.Builder() .setIndexSchema( new IncrementalIndexSchema.Builder() .withMetrics(schemaInfo.getAggsArray()) .withRollup(rollup) .build() ) .setReportParseExceptions(false) .setMaxRowCount(rowsPerSegment) .buildOnheap(); }
private IncrementalIndex makeIncIndex() { return new IncrementalIndex.Builder() .setIndexSchema( new IncrementalIndexSchema.Builder() .withMetrics(schemaInfo.getAggsArray()) .withRollup(rollup) .build() ) .setReportParseExceptions(false) .setMaxRowCount(rowsPerSegment * 2) .buildOnheap(); }
private IncrementalIndex getIndexWithDimsFromSchemata(List<DimensionSchema> dims) { IncrementalIndexSchema schema = new IncrementalIndexSchema.Builder() .withDimensionsSpec(new DimensionsSpec(dims, null, null)) .withMetrics(new CountAggregatorFactory("count")) .build(); return new IncrementalIndex.Builder() .setIndexSchema(schema) .setMaxRowCount(1000) .buildOnheap(); }
@Override public IncrementalIndex createIndex() { return new IncrementalIndex.Builder() .setIndexSchema(schema) .setSortFacts(sortFacts) .setMaxRowCount(1000000) .buildOffheap(stupidPool); } },