use of io.trino.plugin.tpch.TpchColumnHandle in project trino by trinodb.
the class TestRemoveUnsupportedDynamicFilters method setup.
@BeforeClass
public void setup() {
plannerContext = getQueryRunner().getPlannerContext();
metadata = plannerContext.getMetadata();
builder = new PlanBuilder(new PlanNodeIdAllocator(), metadata, TEST_SESSION);
CatalogName catalogName = getCurrentConnectorId();
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)));
}
use of io.trino.plugin.tpch.TpchColumnHandle in project trino by trinodb.
the class TestRemoveRedundantPredicateAboveTableScan method consumesDeterministicPredicateIfNewDomainIsSame.
@Test
public void consumesDeterministicPredicateIfNewDomainIsSame() {
ColumnHandle columnHandle = new TpchColumnHandle("nationkey", BIGINT);
tester().assertThat(removeRedundantPredicateAboveTableScan).on(p -> p.filter(expression("nationkey = BIGINT '44'"), p.tableScan(nationTableHandle, ImmutableList.of(p.symbol("nationkey", BIGINT)), ImmutableMap.of(p.symbol("nationkey", BIGINT), columnHandle), TupleDomain.fromFixedValues(ImmutableMap.of(columnHandle, NullableValue.of(BIGINT, (long) 44)))))).matches(constrainedTableScanWithTableLayout("nation", ImmutableMap.of("nationkey", singleValue(BIGINT, (long) 44)), ImmutableMap.of("nationkey", "nationkey")));
}
use of io.trino.plugin.tpch.TpchColumnHandle in project trino by trinodb.
the class TestRemoveRedundantPredicateAboveTableScan method doesNotFireOnNotFullyExtractedConjunct.
@Test
public void doesNotFireOnNotFullyExtractedConjunct() {
ColumnHandle columnHandle = new TpchColumnHandle("name", VARCHAR);
tester().assertThat(removeRedundantPredicateAboveTableScan).on(p -> p.filter(expression("name LIKE 'LARGE PLATED %'"), p.tableScan(nationTableHandle, ImmutableList.of(p.symbol("name", VARCHAR)), ImmutableMap.of(p.symbol("name", VARCHAR), columnHandle), TupleDomain.fromFixedValues(ImmutableMap.of(columnHandle, NullableValue.of(VARCHAR, Slices.utf8Slice("value"))))))).doesNotFire();
}
use of io.trino.plugin.tpch.TpchColumnHandle in project trino by trinodb.
the class TestRemoveRedundantPredicateAboveTableScan method consumesDeterministicPredicateIfNewDomainIsWider.
@Test
public void consumesDeterministicPredicateIfNewDomainIsWider() {
ColumnHandle columnHandle = new TpchColumnHandle("nationkey", BIGINT);
tester().assertThat(removeRedundantPredicateAboveTableScan).on(p -> p.filter(expression("nationkey = BIGINT '44' OR nationkey = BIGINT '45'"), p.tableScan(nationTableHandle, ImmutableList.of(p.symbol("nationkey", BIGINT)), ImmutableMap.of(p.symbol("nationkey", BIGINT), columnHandle), TupleDomain.fromFixedValues(ImmutableMap.of(columnHandle, NullableValue.of(BIGINT, (long) 44)))))).matches(constrainedTableScanWithTableLayout("nation", ImmutableMap.of("nationkey", singleValue(BIGINT, (long) 44)), ImmutableMap.of("nationkey", "nationkey")));
}
use of io.trino.plugin.tpch.TpchColumnHandle 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));
}
Aggregations