@Setup public void setup() { MetadataManager metadata = MetadataManager.createTestMetadataManager(); ExpressionCompiler expressionCompiler = new ExpressionCompiler( metadata, new PageFunctionCompiler(metadata, 0)); RowExpression projection = generateComplexComparisonProjection(FIELDS_COUNT, COMPARISONS_COUNT); compiledProcessor = expressionCompiler.compilePageProcessor(Optional.empty(), ImmutableList.of(projection)).get(); }
@Setup public void setup() { inputPage = createInputPage(); MetadataManager metadata = MetadataManager.createTestMetadataManager(); compiledProcessor = new ExpressionCompiler(metadata, new PageFunctionCompiler(metadata, 0)).compilePageProcessor(Optional.of(FILTER), ImmutableList.of(PROJECT)).get(); }
@Setup public void setUp() { Random random = new Random(System.nanoTime()); FixedIntArray[] uniqueValues = new FixedIntArray[CARDINALITY]; for (int i = 0; i < uniqueValues.length; i++) { uniqueValues[i] = new FixedIntArray( new int[]{random.nextInt(COLUMN_CARDINALITY), random.nextInt(COLUMN_CARDINALITY), random.nextInt( COLUMN_CARDINALITY)}); } _values = new FixedIntArray[ROW_COUNT]; for (int i = 0; i < _values.length; i++) { _values[i] = uniqueValues[random.nextInt(CARDINALITY)]; } }
@Setup public void setup() { Random rand = ThreadLocalRandom.current(); sequences = new ArrayList<>(); for (int i = 0; i < count; i++) { int[] sequence = new int[sequenceLength]; for (int j = 0; j < sequenceLength; j++) { sequence[j] = rand.nextInt(); } sequences.add(Sequences.simple(Ints.asList(sequence))); } }
@Setup public void setup() { switch (dataType) { case "VARCHAR": types = Collections.nCopies(channelCount, VARCHAR); pages = createVarcharPages(POSITIONS, groupCount, channelCount, hashEnabled); break; case "BIGINT": types = Collections.nCopies(channelCount, BIGINT); pages = createBigintPages(POSITIONS, groupCount, channelCount, hashEnabled); break; default: throw new UnsupportedOperationException("Unsupported dataType"); } hashChannel = hashEnabled ? Optional.of(channelCount) : Optional.empty(); channels = new int[channelCount]; for (int i = 0; i < channelCount; i++) { channels[i] = i; } }
@Setup public void setup(BitmapIterationBenchmark state) { double prob = Math.pow(state.prob, 1.0 / n); MutableBitmap[] mutableBitmaps = new MutableBitmap[n]; for (int i = 0; i < n; i++) { mutableBitmaps[i] = state.factory.makeEmptyMutableBitmap(); } Random r = ThreadLocalRandom.current(); for (int i = 0; i < state.size; i++) { // unions are usually search/filter/select of multiple values of one dimension, so making bitmaps disjoint will // make benchmarks closer to actual workloads MutableBitmap bitmap = mutableBitmaps[r.nextInt(n)]; // In one selected bitmap, set the bit with probability=prob, to have the same fraction of set bit in the union if (r.nextDouble() < prob) { bitmap.add(i); } } bitmaps = new ImmutableBitmap[n]; for (int i = 0; i < n; i++) { bitmaps[i] = state.factory.makeImmutableBitmap(mutableBitmaps[i]); } } }
@Setup public void setup() { Type type = TYPE_MAP.get(this.type); for (int i = 0; i < columnCount; i++) { Symbol symbol = new Symbol(type.getDisplayName().toLowerCase(ENGLISH) + i); symbolTypes.put(symbol, type); sourceLayout.put(symbol, i); } List<RowExpression> projections = getProjections(type); types = projections.stream().map(RowExpression::getType).collect(toList()); MetadataManager metadata = createTestMetadataManager(); PageFunctionCompiler pageFunctionCompiler = new PageFunctionCompiler(metadata, 0); inputPage = createPage(types, dictionaryBlocks); pageProcessor = new ExpressionCompiler(metadata, pageFunctionCompiler).compilePageProcessor(Optional.of(getFilter(type)), projections).get(); recordSet = new PageRecordSet(types, inputPage); cursorProcessor = new ExpressionCompiler(metadata, pageFunctionCompiler).compileCursorProcessor(Optional.of(getFilter(type)), projections, "key").get(); }
@Setup(Level.Iteration) public void setup() { final Random r = new Random(1234567891L); dataIterator = Iterators.cycle( Stream.generate(() -> Math.round(Math.exp(2.0 + r.nextGaussian()))).limit(1048576) .collect(Collectors.toList())); } }
@Setup public void setup() { ImmutableList.Builder<HivePartition> partitions = ImmutableList.builder(); SchemaTableName table = new SchemaTableName("schema", "table"); for (int i = 0; i < TOTAL_SIZE; i++) { partitions.add(new HivePartition(table, "partition_" + i, ImmutableMap.of())); } this.partitions = partitions.build(); } }
@Setup public void setup() { List<Type> types = ImmutableList.copyOf(limit(cycle(BIGINT), FIELDS_COUNT)); ThreadLocalRandom random = ThreadLocalRandom.current(); PageBuilder pageBuilder = new PageBuilder(types); while (!pageBuilder.isFull()) { pageBuilder.declarePosition(); for (int channel = 0; channel < FIELDS_COUNT; channel++) { BlockBuilder blockBuilder = pageBuilder.getBlockBuilder(channel); if (random.nextDouble() < NULLS_FRACTION) { blockBuilder.appendNull(); } else { BIGINT.writeLong(blockBuilder, random.nextLong()); } } } page = pageBuilder.build(); } }
@Setup public void setup(BitmapIterationBenchmark state) { data = new int[(int) (state.size * state.prob) * 2]; dataSize = 0; Random random = ThreadLocalRandom.current(); for (int bit = 0; bit < state.size; bit++) { if (random.nextDouble() < state.prob) { data[dataSize] = bit; dataSize++; } } } }
@Setup public void setup() { pages = createBigintPages(POSITIONS, groupCount, channelCount, hashEnabled); }
@Setup public void setup() { String tpch = "tpch"; session = testSessionBuilder() .setCatalog(tpch) .setSchema("sf1") .setSystemProperty("iterative_optimizer_enabled", iterativeOptimizerEnabled) .build(); queryRunner = new LocalQueryRunner(session); queryRunner.createCatalog(tpch, new TpchConnectorFactory(4), ImmutableMap.of(TPCH_COLUMN_NAMING_PROPERTY, ColumnNaming.STANDARD.name())); queries = IntStream.rangeClosed(1, 22) .boxed() .filter(i -> i != 15) // q15 has two queries in it .map(i -> readResource(String.format("/io/airlift/tpch/queries/q%d.sql", i))) .collect(toImmutableList()); }
@Setup public void setup() { MetadataManager metadata = MetadataManager.createTestMetadataManager(); metadata.addFunctions(extractFunctions(BenchmarkArraySort.class)); ExpressionCompiler compiler = new ExpressionCompiler(metadata, new PageFunctionCompiler(metadata, 0)); ImmutableList.Builder<RowExpression> projectionsBuilder = ImmutableList.builder(); Block[] blocks = new Block[TYPES.size()]; for (int i = 0; i < TYPES.size(); i++) { Type elementType = TYPES.get(i); ArrayType arrayType = new ArrayType(elementType); Signature signature = new Signature(name, FunctionKind.SCALAR, arrayType.getTypeSignature(), arrayType.getTypeSignature()); projectionsBuilder.add(new CallExpression(signature, arrayType, ImmutableList.of(field(i, arrayType)))); blocks[i] = createChannel(POSITIONS, ARRAY_SIZE, arrayType); } ImmutableList<RowExpression> projections = projectionsBuilder.build(); pageProcessor = compiler.compilePageProcessor(Optional.empty(), projections).get(); page = new Page(blocks); }
@Setup public void setup() { inputPage = createInputPage(); MetadataManager metadata = MetadataManager.createTestMetadataManager(); compiledProcessor = new ExpressionCompiler(metadata, new PageFunctionCompiler(metadata, 0)).compilePageProcessor(Optional.of(FILTER), ImmutableList.of(PROJECT)).get(); }