use of io.prestosql.spi.type.BigintType.BIGINT in project hetu-core by openlookeng.
the class TestPruneCountAggregationOverScalar method testDoesNotFireOnNestedCountAggregateWithNonEmptyGroupBy.
@Test
public void testDoesNotFireOnNestedCountAggregateWithNonEmptyGroupBy() {
tester().assertThat(new PruneCountAggregationOverScalar(getFunctionManager())).on(p -> p.aggregation((a) -> a.addAggregation(p.symbol("count_1", BIGINT), new FunctionCallBuilder(tester().getMetadata()).setName(QualifiedName.of("count")).build(), ImmutableList.of(BIGINT)).step(AggregationNode.Step.SINGLE).globalGrouping().source(p.aggregation(aggregationBuilder -> {
aggregationBuilder.source(p.tableScan(ImmutableList.of(), ImmutableMap.of())).groupingSets(singleGroupingSet(ImmutableList.of(p.symbol("orderkey"))));
aggregationBuilder.source(p.tableScan(ImmutableList.of(), ImmutableMap.of()));
})))).doesNotFire();
}
use of io.prestosql.spi.type.BigintType.BIGINT in project hetu-core by openlookeng.
the class TestPushPredicateIntoTableScan method replaceWithExistsWhenNoLayoutExist.
@Test
public void replaceWithExistsWhenNoLayoutExist() {
ColumnHandle columnHandle = new TpchColumnHandle("nationkey", BIGINT);
tester().assertThat(pushPredicateIntoTableScan).on(p -> {
p.symbol("nationkey", BIGINT);
return p.filter(p.rowExpression("nationkey = BIGINT '44'"), p.tableScan(nationTableHandle, ImmutableList.of(p.symbol("nationkey", BIGINT)), ImmutableMap.of(p.symbol("nationkey", BIGINT), columnHandle), TupleDomain.none()));
}).matches(values("A"));
}
use of io.prestosql.spi.type.BigintType.BIGINT in project hetu-core by openlookeng.
the class TestPushProjectionThroughUnion method test.
@Test
public void test() {
FunctionResolution functionResolution = new FunctionResolution(tester().getMetadata().getFunctionAndTypeManager());
tester().assertThat(new PushProjectionThroughUnion()).on(p -> {
Symbol a = p.symbol("a");
Symbol b = p.symbol("b");
Symbol c = p.symbol("c");
Symbol cTimes3 = p.symbol("c_times_3");
return p.project(Assignments.of(cTimes3, call("c * 3", functionResolution.arithmeticFunction(MULTIPLY, BIGINT, BIGINT), BIGINT, p.variable("c"), constant(3L, BIGINT))), p.union(ImmutableListMultimap.<Symbol, Symbol>builder().put(c, a).put(c, b).build(), ImmutableList.of(p.values(a), p.values(b))));
}).matches(union(project(ImmutableMap.of("a_times_3", expression("a * 3")), values(ImmutableList.of("a"))), project(ImmutableMap.of("b_times_3", expression("b * 3")), values(ImmutableList.of("b")))).withNumberOfOutputColumns(1).withAlias("a_times_3").withAlias("b_times_3"));
}
use of io.prestosql.spi.type.BigintType.BIGINT in project hetu-core by openlookeng.
the class TestRemoveAggregationInSemiJoin method semiJoinWithAggregationAsFilteringSource.
private static PlanNode semiJoinWithAggregationAsFilteringSource(PlanBuilder p) {
Symbol leftKey = p.symbol("leftKey");
Symbol rightKey = p.symbol("rightKey");
return p.semiJoin(leftKey, rightKey, p.symbol("match"), Optional.empty(), Optional.empty(), p.values(leftKey), p.aggregation(builder -> builder.globalGrouping().addAggregation(rightKey, expression("count(rightValue)"), ImmutableList.of(BIGINT)).source(p.values(p.symbol("rightValue")))));
}
use of io.prestosql.spi.type.BigintType.BIGINT in project hetu-core by openlookeng.
the class TestPruneWindowColumns method buildProjectedWindow.
private static PlanNode buildProjectedWindow(PlanBuilder p, Predicate<Symbol> projectionFilter, Predicate<Symbol> sourceFilter) {
Symbol orderKey = p.symbol("orderKey");
Symbol partitionKey = p.symbol("partitionKey");
Symbol hash = p.symbol("hash");
Symbol startValue1 = p.symbol("startValue1");
Symbol startValue2 = p.symbol("startValue2");
Symbol endValue1 = p.symbol("endValue1");
Symbol endValue2 = p.symbol("endValue2");
Symbol input1 = p.symbol("input1");
Symbol input2 = p.symbol("input2");
Symbol unused = p.symbol("unused");
Symbol output1 = p.symbol("output1");
Symbol output2 = p.symbol("output2");
List<Symbol> inputs = ImmutableList.of(orderKey, partitionKey, hash, startValue1, startValue2, endValue1, endValue2, input1, input2, unused);
List<Symbol> outputs = ImmutableList.<Symbol>builder().addAll(inputs).add(output1, output2).build();
return p.project(Assignments.copyOf(outputs.stream().filter(projectionFilter).collect(Collectors.toMap(v -> v, v -> p.variable(v.getName(), BIGINT)))), p.window(new WindowNode.Specification(ImmutableList.of(partitionKey), Optional.of(new OrderingScheme(ImmutableList.of(orderKey), ImmutableMap.of(orderKey, SortOrder.ASC_NULLS_FIRST)))), ImmutableMap.of(output1, new WindowNode.Function(call(FUNCTION_NAME, FUNCTION_HANDLE, BIGINT, ImmutableList.of(p.variable(input1.getName()))), ImmutableList.of(p.variable(input1.getName())), new WindowNode.Frame(WindowFrameType.RANGE, UNBOUNDED_PRECEDING, Optional.of(startValue1), CURRENT_ROW, Optional.of(endValue1), Optional.of(startValue1.getName()), Optional.of(endValue2.getName()))), output2, new WindowNode.Function(call(FUNCTION_NAME, FUNCTION_HANDLE, BIGINT, ImmutableList.of(p.variable(input2.getName()))), ImmutableList.of(p.variable(input2.getName())), new WindowNode.Frame(WindowFrameType.RANGE, UNBOUNDED_PRECEDING, Optional.of(startValue2), CURRENT_ROW, Optional.of(endValue2), Optional.of(startValue2.getName()), Optional.of(endValue2.getName())))), hash, p.values(inputs.stream().filter(sourceFilter).collect(toImmutableList()), ImmutableList.of())));
}
Aggregations