use of io.trino.sql.planner.plan.LimitNode in project trino by trinodb.
the class TestCostCalculator method testLimit.
@Test
public void testLimit() {
TableScanNode ts1 = tableScan("ts1", "orderkey");
LimitNode limit = new LimitNode(new PlanNodeId("limit"), ts1, 5, false);
Map<String, PlanNodeStatsEstimate> stats = ImmutableMap.of("ts1", statsEstimate(ts1, 4000), "limit", // 5 * average row size
statsEstimate(ts1, 40));
Map<String, PlanCostEstimate> costs = ImmutableMap.of("ts1", cpuCost(1000));
Map<String, Type> types = ImmutableMap.of("orderkey", BIGINT);
// Do not estimate cost other than CPU for limit node.
assertCost(limit, costs, stats, types).cpu(// 1000 + (is null boolean array) + 40
1045).memory(0).network(0);
assertCostEstimatedExchanges(limit, costs, stats, types).cpu(1045).memory(0).network(0);
}
use of io.trino.sql.planner.plan.LimitNode in project trino by trinodb.
the class TestEffectivePredicateExtractor method testLimit.
@Test
public void testLimit() {
PlanNode node = new LimitNode(newId(), filter(baseTableScan, and(equals(AE, BE), equals(BE, CE), lessThan(CE, bigintLiteral(10)))), 1, false);
Expression effectivePredicate = effectivePredicateExtractor.extract(SESSION, node, TypeProvider.empty(), typeAnalyzer);
// Pass through
assertEquals(normalizeConjuncts(effectivePredicate), normalizeConjuncts(equals(AE, BE), equals(BE, CE), lessThan(CE, bigintLiteral(10))));
}
Aggregations