@Test public void doesNotFireOnPlanWithoutLateralNode() { tester().assertThat(rule) .on(p -> p.values(p.symbol("a"))) .doesNotFire(); }
@Test public void doesNotFireOnCorrelatedNonScalar() { tester().assertThat(rule) .on(p -> p.lateral( ImmutableList.of(p.symbol("corr")), p.values(p.symbol("corr")), p.values(p.symbol("a")))) .doesNotFire(); }
@Test public void testDoesNotFireWithEmptyValuesNode() { tester().assertThat(new TransformCorrelatedSingleRowSubqueryToProject()) .on(p -> p.lateral( ImmutableList.of(p.symbol("a")), p.values(p.symbol("a")), p.values(p.symbol("a")))) .doesNotFire(); } }
@Test public void testDoesNotFire() { tester().assertThat(new TransformCorrelatedSingleRowSubqueryToProject()) .on(p -> p.values(p.symbol("a"))) .doesNotFire(); }
@Test public void doesNotFireOnPlanWithoutWindowFunctions() { tester().assertThat(new GatherAndMergeWindows.SwapAdjacentWindowsBySpecifications(0)) .on(p -> p.values(p.symbol("a"))) .doesNotFire(); }
@Test public void testPlanWithoutWindowNode() { tester().assertThat(new GatherAndMergeWindows.MergeAdjacentWindowsOverProjects(0)) .on(p -> p.values(p.symbol("a"))) .doesNotFire(); }
@Test public void doesNotFireIfNoTableScan() { for (Rule<?> rule : pickTableLayout.rules()) { tester().assertThat(rule) .on(p -> p.values(p.symbol("a", BIGINT))) .doesNotFire(); } }
@Test public void testValueExpressionNotRewritten() { tester().assertThat(zeroRewriter.valuesExpressionRewrite()) .on(p -> p.values( ImmutableList.<Symbol>of(p.symbol("a")), ImmutableList.of((ImmutableList.of(PlanBuilder.expression("0")))))) .doesNotFire(); }
@Test public void testDoesNotFire() { tester().assertThat(new EvaluateZeroLimit()) .on(p -> p.limit( 1, p.values(p.symbol("a")))) .doesNotFire(); }
@Test public void testDoesNotFire() { tester().assertThat(new EvaluateZeroSample()) .on(p -> p.sample( 0.15, Type.BERNOULLI, p.values(p.symbol("a")))) .doesNotFire(); }
@Test public void testDoesNotFire() { tester().assertThat(new RemoveFullSample()) .on(p -> p.sample( 0.15, Type.BERNOULLI, p.values(p.symbol("a")))) .doesNotFire(); }
@Test public void testAllOutputsReferenced() { tester().assertThat(new PruneOutputColumns()) .on(p -> { Symbol a = p.symbol("a"); Symbol b = p.symbol("b"); return p.output( ImmutableList.of("A label", "B label"), ImmutableList.of(a, b), p.values(a, b)); }) .doesNotFire(); } }
@Test public void testDoesNotFire() { tester().assertThat(new RemoveUnreferencedScalarApplyNodes()) .on(p -> p.apply( Assignments.of(p.symbol("z"), p.expression("x IN (y)")), ImmutableList.of(), p.values(p.symbol("x")), p.values(p.symbol("y")))) .doesNotFire(); }
@Test public void testDoesNotFire() { tester().assertThat(new RemoveUnreferencedScalarLateralNodes()) .on(p -> p.lateral( emptyList(), p.values(), p.values())) .doesNotFire(); } }
@Test public void doesNotFireIfTableScanHasTableLayout() { tester().assertThat(pickTableLayout.pickTableLayoutWithoutPredicate()) .on(p -> p.tableScan( nationTableHandle, ImmutableList.of(p.symbol("nationkey", BIGINT)), ImmutableMap.of(p.symbol("nationkey", BIGINT), new TpchColumnHandle("nationkey", BIGINT)), Optional.of(nationTableLayoutHandle))) .doesNotFire(); }
@Test public void testCrossJoinDoesNotFire() { tester().assertThat(new PruneJoinColumns()) .on(p -> { Symbol leftValue = p.symbol("leftValue"); Symbol rightValue = p.symbol("rightValue"); return p.join( JoinNode.Type.INNER, p.values(leftValue), p.values(rightValue), ImmutableList.of(), ImmutableList.of(leftValue, rightValue), Optional.empty(), Optional.empty(), Optional.empty()); }) .doesNotFire(); }
@Test public void testAllColumnsNeeded() { tester().assertThat(new PruneWindowColumns()) .on(p -> buildProjectedWindow(p, alwaysTrue(), alwaysTrue())) .doesNotFire(); }