Search in sources :

Example 6 with TpchTableHandle

use of io.trino.plugin.tpch.TpchTableHandle in project trino by trinodb.

the class TestCostCalculator method tableScan.

private TableScanNode tableScan(String id, String... symbols) {
    List<Symbol> symbolsList = Arrays.stream(symbols).map(Symbol::new).collect(toImmutableList());
    ImmutableMap.Builder<Symbol, ColumnHandle> assignments = ImmutableMap.builder();
    for (Symbol symbol : symbolsList) {
        assignments.put(symbol, new TpchColumnHandle("orderkey", BIGINT));
    }
    TpchTableHandle tableHandle = new TpchTableHandle("sf1", "orders", 1.0);
    return new TableScanNode(new PlanNodeId(id), new TableHandle(new CatalogName("tpch"), tableHandle, INSTANCE), symbolsList, assignments.buildOrThrow(), TupleDomain.all(), Optional.empty(), false, Optional.of(false));
}
Also used : PlanNodeId(io.trino.sql.planner.plan.PlanNodeId) TpchColumnHandle(io.trino.plugin.tpch.TpchColumnHandle) ColumnHandle(io.trino.spi.connector.ColumnHandle) TableScanNode(io.trino.sql.planner.plan.TableScanNode) TpchColumnHandle(io.trino.plugin.tpch.TpchColumnHandle) Symbol(io.trino.sql.planner.Symbol) TpchTableHandle(io.trino.plugin.tpch.TpchTableHandle) TableHandle(io.trino.metadata.TableHandle) CatalogName(io.trino.connector.CatalogName) ImmutableMap(com.google.common.collect.ImmutableMap) ImmutableMap.toImmutableMap(com.google.common.collect.ImmutableMap.toImmutableMap) TpchTableHandle(io.trino.plugin.tpch.TpchTableHandle)

Example 7 with TpchTableHandle

use of io.trino.plugin.tpch.TpchTableHandle in project trino by trinodb.

the class TestDynamicFiltersChecker method setup.

@BeforeClass
public void setup() {
    plannerContext = getQueryRunner().getPlannerContext();
    metadata = plannerContext.getMetadata();
    builder = new PlanBuilder(new PlanNodeIdAllocator(), metadata, TEST_SESSION);
    CatalogName catalogName = getCurrentConnectorId();
    TableHandle lineitemTableHandle = new TableHandle(catalogName, new TpchTableHandle("sf1", "lineitem", 1.0), TestingTransactionHandle.create());
    lineitemOrderKeySymbol = builder.symbol("LINEITEM_OK", BIGINT);
    lineitemTableScanNode = builder.tableScan(lineitemTableHandle, ImmutableList.of(lineitemOrderKeySymbol), ImmutableMap.of(lineitemOrderKeySymbol, new TpchColumnHandle("orderkey", BIGINT)));
    TableHandle ordersTableHandle = new TableHandle(catalogName, new TpchTableHandle("sf1", "orders", 1.0), TestingTransactionHandle.create());
    ordersOrderKeySymbol = builder.symbol("ORDERS_OK", BIGINT);
    ordersTableScanNode = builder.tableScan(ordersTableHandle, ImmutableList.of(ordersOrderKeySymbol), ImmutableMap.of(ordersOrderKeySymbol, new TpchColumnHandle("orderkey", BIGINT)));
}
Also used : PlanNodeIdAllocator(io.trino.sql.planner.PlanNodeIdAllocator) TpchColumnHandle(io.trino.plugin.tpch.TpchColumnHandle) CatalogName(io.trino.connector.CatalogName) TpchTableHandle(io.trino.plugin.tpch.TpchTableHandle) TableHandle(io.trino.metadata.TableHandle) PlanBuilder(io.trino.sql.planner.iterative.rule.test.PlanBuilder) TpchTableHandle(io.trino.plugin.tpch.TpchTableHandle) BeforeClass(org.testng.annotations.BeforeClass)

Example 8 with TpchTableHandle

use of io.trino.plugin.tpch.TpchTableHandle in project trino by trinodb.

the class TestValidateAggregationsWithDefaultValues method setup.

@BeforeClass
public void setup() {
    plannerContext = getQueryRunner().getPlannerContext();
    builder = new PlanBuilder(new PlanNodeIdAllocator(), plannerContext.getMetadata(), TEST_SESSION);
    CatalogName catalogName = getCurrentConnectorId();
    TableHandle nationTableHandle = new TableHandle(catalogName, new TpchTableHandle("sf1", "nation", 1.0), TestingTransactionHandle.create());
    TpchColumnHandle nationkeyColumnHandle = new TpchColumnHandle("nationkey", BIGINT);
    symbol = new Symbol("nationkey");
    tableScanNode = builder.tableScan(nationTableHandle, ImmutableList.of(symbol), ImmutableMap.of(symbol, nationkeyColumnHandle));
}
Also used : PlanNodeIdAllocator(io.trino.sql.planner.PlanNodeIdAllocator) TpchColumnHandle(io.trino.plugin.tpch.TpchColumnHandle) Symbol(io.trino.sql.planner.Symbol) CatalogName(io.trino.connector.CatalogName) TpchTableHandle(io.trino.plugin.tpch.TpchTableHandle) TableHandle(io.trino.metadata.TableHandle) PlanBuilder(io.trino.sql.planner.iterative.rule.test.PlanBuilder) TpchTableHandle(io.trino.plugin.tpch.TpchTableHandle) BeforeClass(org.testng.annotations.BeforeClass)

Example 9 with TpchTableHandle

use of io.trino.plugin.tpch.TpchTableHandle in project trino by trinodb.

the class TestValidateStreamingAggregations method setup.

@BeforeClass
public void setup() {
    plannerContext = getQueryRunner().getPlannerContext();
    typeAnalyzer = createTestingTypeAnalyzer(plannerContext);
    CatalogName catalogName = getCurrentConnectorId();
    nationTableHandle = new TableHandle(catalogName, new TpchTableHandle("sf1", "nation", 1.0), TpchTransactionHandle.INSTANCE);
}
Also used : CatalogName(io.trino.connector.CatalogName) TableHandle(io.trino.metadata.TableHandle) TpchTableHandle(io.trino.plugin.tpch.TpchTableHandle) TpchTableHandle(io.trino.plugin.tpch.TpchTableHandle) BeforeClass(org.testng.annotations.BeforeClass)

Example 10 with TpchTableHandle

use of io.trino.plugin.tpch.TpchTableHandle in project trino by trinodb.

the class TestPushPredicateIntoTableScan method setUpBeforeClass.

@BeforeClass
public void setUpBeforeClass() {
    pushPredicateIntoTableScan = new PushPredicateIntoTableScan(tester().getPlannerContext(), createTestingTypeAnalyzer(tester().getPlannerContext()));
    CatalogName catalogName = tester().getCurrentConnectorId();
    tester().getQueryRunner().createCatalog(MOCK_CATALOG, createMockFactory(), ImmutableMap.of());
    TpchTableHandle nation = new TpchTableHandle("sf1", "nation", 1.0);
    nationTableHandle = new TableHandle(catalogName, nation, TpchTransactionHandle.INSTANCE);
    TpchTableHandle orders = new TpchTableHandle("sf1", "orders", 1.0);
    ordersTableHandle = new TableHandle(catalogName, orders, TpchTransactionHandle.INSTANCE);
}
Also used : CatalogName(io.trino.connector.CatalogName) TpchTableHandle(io.trino.plugin.tpch.TpchTableHandle) ConnectorTableHandle(io.trino.spi.connector.ConnectorTableHandle) MockConnectorTableHandle(io.trino.connector.MockConnectorTableHandle) TableHandle(io.trino.metadata.TableHandle) TpchTableHandle(io.trino.plugin.tpch.TpchTableHandle) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

TpchTableHandle (io.trino.plugin.tpch.TpchTableHandle)14 TableHandle (io.trino.metadata.TableHandle)11 CatalogName (io.trino.connector.CatalogName)9 TpchColumnHandle (io.trino.plugin.tpch.TpchColumnHandle)7 BeforeClass (org.testng.annotations.BeforeClass)6 ImmutableMap (com.google.common.collect.ImmutableMap)5 ImmutableList (com.google.common.collect.ImmutableList)4 ColumnHandle (io.trino.spi.connector.ColumnHandle)4 TupleDomain (io.trino.spi.predicate.TupleDomain)3 PlanNodeIdAllocator (io.trino.sql.planner.PlanNodeIdAllocator)3 Symbol (io.trino.sql.planner.Symbol)3 PlanMatchPattern (io.trino.sql.planner.assertions.PlanMatchPattern)3 PlanBuilder (io.trino.sql.planner.iterative.rule.test.PlanBuilder)3 Test (org.testng.annotations.Test)3 TEST_SESSION (io.trino.SessionTestUtils.TEST_SESSION)2 ConnectorTableHandle (io.trino.spi.connector.ConnectorTableHandle)2 SchemaTableName (io.trino.spi.connector.SchemaTableName)2 SortOrder (io.trino.spi.connector.SortOrder)2 BIGINT (io.trino.spi.type.BigintType.BIGINT)2 RowType (io.trino.spi.type.RowType)2