Search in sources :

Example 1 with SpatialIndexBuilderOperatorFactory

use of io.trino.operator.SpatialIndexBuilderOperator.SpatialIndexBuilderOperatorFactory in project trino by trinodb.

the class TestSpatialJoinOperator method buildIndex.

private PagesSpatialIndexFactory buildIndex(DriverContext driverContext, SpatialPredicate spatialRelationshipTest, Optional<Integer> radiusChannel, Optional<Integer> partitionChannel, Optional<String> kdbTreeJson, Optional<InternalJoinFilterFunction> filterFunction, RowPagesBuilder buildPages) {
    Optional<JoinFilterFunctionCompiler.JoinFilterFunctionFactory> filterFunctionFactory = filterFunction.map(function -> (session, addresses, pages) -> new StandardJoinFilterFunction(function, addresses, pages));
    ValuesOperator.ValuesOperatorFactory valuesOperatorFactory = new ValuesOperator.ValuesOperatorFactory(0, new PlanNodeId("test"), buildPages.build());
    SpatialIndexBuilderOperatorFactory buildOperatorFactory = new SpatialIndexBuilderOperatorFactory(1, new PlanNodeId("test"), buildPages.getTypes(), Ints.asList(1), 0, radiusChannel, partitionChannel, spatialRelationshipTest, kdbTreeJson, filterFunctionFactory, 10_000, new TestingFactory(false));
    Driver driver = Driver.createDriver(driverContext, valuesOperatorFactory.createOperator(driverContext), buildOperatorFactory.createOperator(driverContext));
    PagesSpatialIndexFactory pagesSpatialIndexFactory = buildOperatorFactory.getPagesSpatialIndexFactory();
    ListenableFuture<PagesSpatialIndex> pagesSpatialIndex = pagesSpatialIndexFactory.createPagesSpatialIndex();
    while (!pagesSpatialIndex.isDone()) {
        driver.process();
    }
    runDriverInThread(executor, driver);
    return pagesSpatialIndexFactory;
}
Also used : SpatialIndexBuilderOperatorFactory(io.trino.operator.SpatialIndexBuilderOperator.SpatialIndexBuilderOperatorFactory) StandardJoinFilterFunction(io.trino.operator.join.StandardJoinFilterFunction) PagesSpatialIndex(io.trino.operator.PagesSpatialIndex) Driver(io.trino.operator.Driver) PlanNodeId(io.trino.sql.planner.plan.PlanNodeId) TestingFactory(io.trino.operator.PagesIndex.TestingFactory) ValuesOperator(io.trino.operator.ValuesOperator) PagesSpatialIndexFactory(io.trino.operator.PagesSpatialIndexFactory)

Aggregations

Driver (io.trino.operator.Driver)1 TestingFactory (io.trino.operator.PagesIndex.TestingFactory)1 PagesSpatialIndex (io.trino.operator.PagesSpatialIndex)1 PagesSpatialIndexFactory (io.trino.operator.PagesSpatialIndexFactory)1 SpatialIndexBuilderOperatorFactory (io.trino.operator.SpatialIndexBuilderOperator.SpatialIndexBuilderOperatorFactory)1 ValuesOperator (io.trino.operator.ValuesOperator)1 StandardJoinFilterFunction (io.trino.operator.join.StandardJoinFilterFunction)1 PlanNodeId (io.trino.sql.planner.plan.PlanNodeId)1