use of org.openjdk.jmh.annotations.Setup in project crate by crate.
the class AggregateCollectorBenchmark method setup.
@Setup
public void setup() {
InputCollectExpression inExpr0 = new InputCollectExpression(0);
Functions functions = new ModulesBuilder().add(new AggregationImplModule()).createInjector().getInstance(Functions.class);
SumAggregation<?> sumAggregation = (SumAggregation<?>) functions.getQualified(Signature.aggregate(SumAggregation.NAME, DataTypes.INTEGER.getTypeSignature(), DataTypes.LONG.getTypeSignature()), List.of(DataTypes.INTEGER), DataTypes.INTEGER);
var memoryManager = new OnHeapMemoryManager(bytes -> {
});
collector = new AggregateCollector(Collections.singletonList(inExpr0), RamAccounting.NO_ACCOUNTING, memoryManager, Version.CURRENT, AggregateMode.ITER_FINAL, new AggregationFunction[] { sumAggregation }, Version.CURRENT, new Input[][] { { inExpr0 } }, new Input[] { Literal.BOOLEAN_TRUE });
}
use of org.openjdk.jmh.annotations.Setup in project crate by crate.
the class GroupingStringCollectorBenchmark method createGroupingCollector.
@Setup
public void createGroupingCollector() {
Functions functions = new ModulesBuilder().add(new AggregationImplModule()).createInjector().getInstance(Functions.class);
groupByMinCollector = createGroupByMinBytesRefCollector(functions);
memoryManager = new OnHeapMemoryManager(bytes -> {
});
List<String> keys = new ArrayList<>(Locale.getISOCountries().length);
keys.addAll(Arrays.asList(Locale.getISOCountries()));
rows = new ArrayList<>(20_000_000);
for (int i = 0; i < 20_000_000; i++) {
rows.add(new Row1(keys.get(i % keys.size())));
}
}
use of org.openjdk.jmh.annotations.Setup in project crate by crate.
the class CsvReaderBenchmark method create_temp_file_and_uri.
@Setup
public void create_temp_file_and_uri() throws IOException {
NodeContext nodeCtx = new NodeContext(new Functions(Map.of()));
inputFactory = new InputFactory(nodeCtx);
tempFile = File.createTempFile("temp", null);
fileUri = tempFile.toURI().getPath();
try (OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(tempFile), StandardCharsets.UTF_8)) {
writer.write("name,id\n");
writer.write("Arthur,4\n");
writer.write("Trillian,5\n");
writer.write("Emma,5\n");
writer.write("Emily,9\n");
writer.write("Sarah,5\n");
writer.write("John,5\n");
writer.write("Mical,9\n");
writer.write("Mary,5\n");
writer.write("Jimmy,9\n");
writer.write("Tom,5\n");
writer.write("Neil,0\n");
writer.write("Rose,5\n");
writer.write("Gobnait,5\n");
writer.write("Rory,1\n");
writer.write("Martin,11\n");
writer.write("Arthur,4\n");
writer.write("Trillian,5\n");
writer.write("Emma,5\n");
writer.write("Emily,9\n");
writer.write("Sarah,5\n");
writer.write("John,5\n");
writer.write("Mical,9\n");
writer.write("Mary,5\n");
writer.write("Jimmy,9\n");
writer.write("Tom,5\n");
writer.write("Neil,0\n");
writer.write("Rose,5\n");
writer.write("Gobnait,5\n");
writer.write("Rory,1\n");
writer.write("Martin,11\n");
}
}
use of org.openjdk.jmh.annotations.Setup in project crate by crate.
the class HyperLogLogDistinctAggregationBenchmark method setUp.
@Setup
public void setUp() throws Exception {
hash = new MurmurHash3.Hash128();
final InputCollectExpression inExpr0 = new InputCollectExpression(0);
Functions functions = new ModulesBuilder().add(new ExtraFunctionsModule()).createInjector().getInstance(Functions.class);
final HyperLogLogDistinctAggregation hllAggregation = (HyperLogLogDistinctAggregation) functions.getQualified(Signature.aggregate(HyperLogLogDistinctAggregation.NAME, DataTypes.STRING.getTypeSignature(), DataTypes.LONG.getTypeSignature()), List.of(DataTypes.STRING), DataTypes.STRING);
onHeapMemoryManager = new OnHeapMemoryManager(bytes -> {
});
offHeapMemoryManager = new OffHeapMemoryManager();
hyperLogLogPlusPlus = new HyperLogLogPlusPlus(HyperLogLogPlusPlus.DEFAULT_PRECISION, onHeapMemoryManager::allocate);
onHeapCollector = new AggregateCollector(Collections.singletonList(inExpr0), RamAccounting.NO_ACCOUNTING, onHeapMemoryManager, Version.CURRENT, AggregateMode.ITER_FINAL, new AggregationFunction[] { hllAggregation }, Version.CURRENT, new Input[][] { { inExpr0 } }, new Input[] { Literal.BOOLEAN_TRUE });
offHeapCollector = new AggregateCollector(Collections.singletonList(inExpr0), RamAccounting.NO_ACCOUNTING, offHeapMemoryManager, Version.CURRENT, AggregateMode.ITER_FINAL, new AggregationFunction[] { hllAggregation }, Version.CURRENT, new Input[][] { { inExpr0 } }, new Input[] { Literal.BOOLEAN_TRUE });
}
use of org.openjdk.jmh.annotations.Setup in project crate by crate.
the class PreExecutionBenchmark method setup.
@Setup
public void setup() throws Exception {
Path tempDir = Files.createTempDirectory("");
Settings settings = Settings.builder().put("path.home", tempDir.toAbsolutePath().toString()).build();
Environment environment = new Environment(settings, tempDir);
node = new Node(environment, List.of(Netty4Plugin.class), true);
node.start();
Injector injector = node.injector();
sqlOperations = injector.getInstance(SQLOperations.class);
analyzer = injector.getInstance(Analyzer.class);
planner = injector.getInstance(Planner.class);
clusterService = injector.getInstance(ClusterService.class);
nodeCtx = injector.getInstance(NodeContext.class);
String statement = "create table users (id int primary key, name string, date timestamp, text string index using fulltext)";
var resultReceiver = new BaseResultReceiver();
sqlOperations.newSystemSession().quickExec(statement, resultReceiver, Row.EMPTY);
resultReceiver.completionFuture().get(5, TimeUnit.SECONDS);
}
Aggregations