Skip to content

Commit

Permalink
abstract common base of SQL micro-benchmarks to reduce boilerplate an…
Browse files Browse the repository at this point in the history
…d standardize parameters (apache#17383)

changes:
* adds `SqlBenchmarkDatasets` which contains commonly used benchmark data generator schemas
* adds `SqlBaseBenchmark` which contains common benchmark segment generation methods for any benchmark using `SqlBenchmarkDatasets`
* adds `SqlBaseQueryBenchmark` and `SqlBasePlanBenchmark` for benchmarks measuring queries and planning respectively
* migrate all existing SQL jmh benchmarks to extend `SqlBaseQueryBenchmark`, quite dramatically reducing the boilerplate needed to create benchmarks, and allowing the use of multiple datasources within a benchmark file
* adjustments to data generator stuff to allow passing in an ObjectMapper so that the same mapper can be used for both benchmark queries and segment generation, avoiding the need to register stuff with both mappers for benchmarks
* adds `SqlProjectionsBenchmark` and `SqlComplexMetricsColumnsBenchmark` for measuring projections and measuring complex metric compression respectively
  • Loading branch information
clintropolis authored Oct 23, 2024
1 parent 9dfb378 commit 1157ecd
Show file tree
Hide file tree
Showing 16 changed files with 1,770 additions and 1,757 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
package org.apache.druid.benchmark.lookup;

import com.google.common.collect.ImmutableMap;
import org.apache.druid.benchmark.query.SqlBenchmark;
import org.apache.druid.benchmark.query.SqlBaseBenchmark;
import org.apache.druid.common.config.NullHandling;
import org.apache.druid.java.util.common.Pair;
import org.apache.druid.java.util.common.StringUtils;
Expand Down Expand Up @@ -54,6 +54,7 @@
import org.openjdk.jmh.infra.Blackhole;

import javax.annotation.Nullable;
import java.util.Collections;
import java.util.concurrent.TimeUnit;

/**
Expand Down Expand Up @@ -111,10 +112,11 @@ public void setup()
final QueryableIndex index =
segmentGenerator.generate(dataSegment, schemaInfo, IndexSpec.DEFAULT, Granularities.NONE, 1);

final Pair<PlannerFactory, SqlEngine> sqlSystem = SqlBenchmark.createSqlSystem(
final Pair<PlannerFactory, SqlEngine> sqlSystem = SqlBaseBenchmark.createSqlSystem(
ImmutableMap.of(dataSegment, index),
Collections.emptyMap(),
ImmutableMap.of("benchmark-lookup", lookup),
null,
SqlBaseBenchmark.BenchmarkStorage.MMAP,
closer
);

Expand Down
Loading

0 comments on commit 1157ecd

Please sign in to comment.