/** * A helper method to set a simple index schema with controllable metrics and rollup, and default values for the * other parameters. Note that this method is normally used for testing and benchmarking; it is unlikely that you * would use it in production settings. * * @param metrics variable array of {@link AggregatorFactory} metrics * * @return this */ @VisibleForTesting public Builder setSimpleTestingIndexSchema(@Nullable Boolean rollup, final AggregatorFactory... metrics) { IncrementalIndexSchema.Builder builder = new IncrementalIndexSchema.Builder().withMetrics(metrics); this.incrementalIndexSchema = rollup != null ? builder.withRollup(rollup).build() : builder.build(); return this; }
.withDimensionsSpec(new DimensionsSpec(dimensions, ImmutableList.of(), ImmutableList.of())) .withMetrics(schemaInfo.getAggsArray()) .withRollup(schemaInfo.isWithRollup()) .withQueryGranularity(granularity) .build();
new IncrementalIndexSchema.Builder() .withMetrics(factories) .withRollup(false) .build()
.withRollup(false) .build();
.withRollup(false) .build(); IncrementalIndex toPersistA = new IncrementalIndex.Builder()
new HyperUniquesAggregatorFactory("unique_dim1", "dim1") .withRollup(false) .build() new IncrementalIndexSchema.Builder() .withMetrics(new LongSumAggregatorFactory("m1", "m1")) .withRollup(false) .build()
new IncrementalIndexSchema.Builder() .withMetrics(new CountAggregatorFactory("cnt")) .withRollup(false) .build() new HyperUniquesAggregatorFactory("uniques", "c2") .withRollup(false) .build() new HyperUniquesAggregatorFactory("uniques", "c2") .withRollup(false) .build() new IncrementalIndexSchema.Builder() .withMetrics(new HyperUniquesAggregatorFactory("c2", "c2")) .withRollup(false) .build()
.withDimensionsSpec(schema.getParser()) .withMetrics(schema.getAggregators()) .withRollup(schema.getGranularitySpec().isRollup()) .build(); final IncrementalIndex newIndex = new IncrementalIndex.Builder()
new HyperUniquesAggregatorFactory("unique_dim1", "dim1") .withRollup(false) .build() new IncrementalIndexSchema.Builder() .withMetrics(new LongSumAggregatorFactory("m1", "m1")) .withRollup(false) .build()
.withRollup(false) .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(); }
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() .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 IncrementalIndex makeIncIndex() { return new IncrementalIndex.Builder() .setIndexSchema( new IncrementalIndexSchema.Builder() .withMetrics(schemaInfo.getAggsArray()) .withRollup(rollup) .build() ) .setReportParseExceptions(false) .setMaxRowCount(rowsPerSegment * 2) .buildOnheap(); }
private IncrementalIndex makeIncIndex() { return new IncrementalIndex.Builder() .setIndexSchema( new IncrementalIndexSchema.Builder() .withMetrics(schemaInfo.getAggsArray()) .withRollup(rollup) .build() ) .setReportParseExceptions(false) .setMaxRowCount(rowsPerSegment) .buildOnheap(); }