use of com.facebook.presto.sql.gen.ExpressionCompiler in project presto by prestodb.
the class PredicateFilterBenchmark method createOperatorFactories.
@Override
protected List<? extends OperatorFactory> createOperatorFactories() {
Metadata metadata = localQueryRunner.getMetadata();
OperatorFactory tableScanOperator = createTableScanOperator(0, new PlanNodeId("test"), "orders", "totalprice");
RowExpression filter = call(GREATER_THAN_OR_EQUAL.name(), metadata.getFunctionAndTypeManager().resolveOperator(GREATER_THAN_OR_EQUAL, fromTypes(DOUBLE, DOUBLE)), BOOLEAN, field(0, DOUBLE), constant(50000.0, DOUBLE));
ExpressionCompiler expressionCompiler = new ExpressionCompiler(metadata, new PageFunctionCompiler(metadata, 0));
Supplier<PageProcessor> pageProcessor = expressionCompiler.compilePageProcessor(localQueryRunner.getDefaultSession().getSqlFunctionProperties(), Optional.of(filter), ImmutableList.of(field(0, DOUBLE)));
FilterAndProjectOperator.FilterAndProjectOperatorFactory filterAndProjectOperator = new FilterAndProjectOperator.FilterAndProjectOperatorFactory(1, new PlanNodeId("test"), pageProcessor, ImmutableList.of(DOUBLE), new DataSize(0, BYTE), 0);
return ImmutableList.of(tableScanOperator, filterAndProjectOperator);
}
use of com.facebook.presto.sql.gen.ExpressionCompiler in project presto by prestodb.
the class TestFilterAndProjectOperator method testMergeOutput.
@Test
public void testMergeOutput() {
List<Page> input = rowPagesBuilder(VARCHAR, BIGINT).addSequencePage(100, 0, 0).addSequencePage(100, 0, 0).addSequencePage(100, 0, 0).addSequencePage(100, 0, 0).build();
MetadataManager metadata = createTestMetadataManager();
RowExpression filter = call(EQUAL.name(), metadata.getFunctionAndTypeManager().resolveOperator(EQUAL, fromTypes(BIGINT, BIGINT)), BOOLEAN, field(1, BIGINT), constant(10L, BIGINT));
ExpressionCompiler compiler = new ExpressionCompiler(metadata, new PageFunctionCompiler(metadata, 0));
Supplier<PageProcessor> processor = compiler.compilePageProcessor(TEST_SESSION.getSqlFunctionProperties(), Optional.of(filter), ImmutableList.of(field(1, BIGINT)));
OperatorFactory operatorFactory = new FilterAndProjectOperator.FilterAndProjectOperatorFactory(0, new PlanNodeId("test"), processor, ImmutableList.of(BIGINT), new DataSize(64, KILOBYTE), 2);
List<Page> expected = rowPagesBuilder(BIGINT).row(10L).row(10L).row(10L).row(10L).build();
assertOperatorEquals(operatorFactory, ImmutableList.of(BIGINT), driverContext, input, expected);
}
use of com.facebook.presto.sql.gen.ExpressionCompiler in project presto by prestodb.
the class TaskTestUtils method createTestingPlanner.
public static LocalExecutionPlanner createTestingPlanner() {
MetadataManager metadata = MetadataManager.createTestMetadataManager();
PageSourceManager pageSourceManager = new PageSourceManager();
pageSourceManager.addConnectorPageSourceProvider(CONNECTOR_ID, new TestingPageSourceProvider());
// we don't start the finalizer so nothing will be collected, which is ok for a test
FinalizerService finalizerService = new FinalizerService();
NodeScheduler nodeScheduler = new NodeScheduler(new LegacyNetworkTopology(), new InMemoryNodeManager(), new NodeSelectionStats(), new NodeSchedulerConfig().setIncludeCoordinator(true), new NodeTaskMap(finalizerService), new ThrowingNodeTtlFetcherManager(), new NoOpQueryManager(), new SimpleTtlNodeSelectorConfig());
PartitioningProviderManager partitioningProviderManager = new PartitioningProviderManager();
NodePartitioningManager nodePartitioningManager = new NodePartitioningManager(nodeScheduler, partitioningProviderManager, new NodeSelectionStats());
PageFunctionCompiler pageFunctionCompiler = new PageFunctionCompiler(metadata, 0);
return new LocalExecutionPlanner(metadata, Optional.empty(), pageSourceManager, new IndexManager(), partitioningProviderManager, nodePartitioningManager, new PageSinkManager(), new ConnectorMetadataUpdaterManager(), new ExpressionCompiler(metadata, pageFunctionCompiler), pageFunctionCompiler, new JoinFilterFunctionCompiler(metadata), new IndexJoinLookupStats(), new TaskManagerConfig(), new MemoryManagerConfig(), new GenericSpillerFactory((types, spillContext, memoryContext) -> {
throw new UnsupportedOperationException();
}), (types, spillContext, memoryContext) -> {
throw new UnsupportedOperationException();
}, (types, partitionFunction, spillContext, memoryContext) -> {
throw new UnsupportedOperationException();
}, new BlockEncodingManager(), new PagesIndex.TestingFactory(false), new JoinCompiler(MetadataManager.createTestMetadataManager(), new FeaturesConfig()), new LookupJoinOperators(), new OrderingCompiler(), jsonCodec(TableCommitContext.class), new RowExpressionDeterminismEvaluator(metadata), new NoOpFragmentResultCacheManager(), new ObjectMapper(), (session) -> {
throw new UnsupportedOperationException();
});
}
use of com.facebook.presto.sql.gen.ExpressionCompiler in project presto by prestodb.
the class TestPageProcessorCompiler method setup.
@BeforeClass
public void setup() {
metadataManager = createTestMetadataManager();
compiler = new ExpressionCompiler(metadataManager, new PageFunctionCompiler(metadataManager, 0));
}
use of com.facebook.presto.sql.gen.ExpressionCompiler in project presto by prestodb.
the class BenchmarkEqualsOperator method setup.
@Setup
public void setup() {
MetadataManager metadata = MetadataManager.createTestMetadataManager();
FunctionAndTypeManager functionAndTypeManager = metadata.getFunctionAndTypeManager();
ExpressionCompiler expressionCompiler = new ExpressionCompiler(metadata, new PageFunctionCompiler(metadata, 0));
RowExpression projection = generateComplexComparisonProjection(functionAndTypeManager, FIELDS_COUNT, COMPARISONS_COUNT);
compiledProcessor = expressionCompiler.compilePageProcessor(SESSION.getSqlFunctionProperties(), Optional.empty(), ImmutableList.of(projection)).get();
}
Aggregations