final IncrementalIndexSchema schema = new IncrementalIndexSchema.Builder() .withMinTimestamp(DateTimes.of("2011-01-13T00:00:00.000Z").getMillis()) .withDimensionsSpec(ROW_PARSER) .withMetrics( new DoubleSumAggregatorFactory(DIM_FLOAT_NAME, DIM_FLOAT_NAME)
final IncrementalIndexSchema schema = new IncrementalIndexSchema.Builder() .withMinTimestamp(JodaUtils.MIN_INSTANT) .withDimensionsSpec(ROW_PARSER) .withMetrics(new LongSumAggregatorFactory(METRICS[0], METRICS[0])) .build();
.withTimestampSpec(schema.getParser()) .withQueryGranularity(schema.getGranularitySpec().getQueryGranularity()) .withDimensionsSpec(schema.getParser()) .withMetrics(schema.getAggregators()) .withRollup(schema.getGranularitySpec().isRollup())
.withDimensionsSpec(new DimensionsSpec( makeDimensionSchemas(Arrays.asList("dimA", "dimB", "dimC")), null,
final IncrementalIndexSchema schema = new IncrementalIndexSchema.Builder() .withQueryGranularity(Granularities.MINUTE) .withDimensionsSpec(dimensions) .withMetrics(metrics) .build();
.setIndexSchema( new IncrementalIndexSchema.Builder() .withDimensionsSpec(DIMENSIONS_SPEC_REINDEX) .withMetrics(AGGREGATORS_REINDEX.toArray(new AggregatorFactory[0])) .build()
.setIndexSchema( new IncrementalIndexSchema.Builder() .withDimensionsSpec(parser.getParseSpec().getDimensionsSpec()) .withMetrics(AGGREGATORS.toArray(new AggregatorFactory[0])) .build()
public static IncrementalIndex makeRealtimeIndex(final CharSource source, boolean rollup) { final IncrementalIndexSchema schema = new IncrementalIndexSchema.Builder() .withMinTimestamp(DateTimes.of("2011-01-12T00:00:00.000Z").getMillis()) .withTimestampSpec(new TimestampSpec("ds", "auto", null)) .withDimensionsSpec(DIMENSIONS_SPEC) .withVirtualColumns(VIRTUAL_COLUMNS) .withMetrics(METRIC_AGGS) .withRollup(rollup) .build(); final IncrementalIndex retVal = new IncrementalIndex.Builder() .setIndexSchema(schema) .setMaxRowCount(10000) .buildOnheap(); try { return loadIncrementalIndex(retVal, source); } catch (Exception e) { if (rollup) { realtimeIndex = null; } else { noRollupRealtimeIndex = null; } throw Throwables.propagate(e); } }
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(); }
public FloatAndDoubleFilteringTest( String testName, IndexBuilder indexBuilder, Function<IndexBuilder, Pair<StorageAdapter, Closeable>> finisher, boolean cnf, boolean optimize ) { super( testName, ROWS, indexBuilder.schema( new IncrementalIndexSchema.Builder() .withDimensionsSpec(PARSER.getParseSpec().getDimensionsSpec()) .build() ), finisher, cnf, optimize ); }
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(); }
@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 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(); }
public ExpressionFilterTest( String testName, IndexBuilder indexBuilder, Function<IndexBuilder, Pair<StorageAdapter, Closeable>> finisher, boolean cnf, boolean optimize ) { super( testName, ROWS, indexBuilder.schema( new IncrementalIndexSchema.Builder() .withDimensionsSpec(PARSER.getParseSpec().getDimensionsSpec()).build() ), finisher, cnf, optimize ); }
public SelectorFilterTest( String testName, IndexBuilder indexBuilder, Function<IndexBuilder, Pair<StorageAdapter, Closeable>> finisher, boolean cnf, boolean optimize ) { super( testName, ROWS, indexBuilder.schema( new IncrementalIndexSchema.Builder() .withDimensionsSpec(PARSER.getParseSpec().getDimensionsSpec()).build() ), finisher, cnf, optimize ); }
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 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 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(); }