use of io.prestosql.spi.plan.PlanNode in project hetu-core by openlookeng.
the class TestExternalFunctionPushDownChecker method testValueNodeWithExternalCall.
@Test(expectedExceptions = ExternalFunctionPushDownChecker.IllegalExternalFunctionUsageException.class, expectedExceptionsMessageRegExp = "The external function jdbc.v1.foo does not support to push down to data source for this query.")
public void testValueNodeWithExternalCall() {
PlanNode root = builder.values(ImmutableList.of(columnA), ImmutableList.of(ImmutableList.of(externalFooCall1)));
validatePlan(root);
}
use of io.prestosql.spi.plan.PlanNode in project hetu-core by openlookeng.
the class TestValidateStreamingAggregations method validatePlan.
private void validatePlan(Function<PlanBuilder, PlanNode> planProvider) {
PlanBuilder builder = new PlanBuilder(idAllocator, metadata);
PlanNode planNode = planProvider.apply(builder);
TypeProvider types = builder.getTypes();
getQueryRunner().inTransaction(session -> {
// metadata.getCatalogHandle() registers the catalog for the transaction
session.getCatalog().ifPresent(catalog -> metadata.getCatalogHandle(session, catalog));
new ValidateStreamingAggregations().validate(planNode, session, metadata, typeAnalyzer, types, WarningCollector.NOOP);
return null;
});
}
use of io.prestosql.spi.plan.PlanNode 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.plan.PlanNode in project hetu-core by openlookeng.
the class TestRemoveAggregationInSemiJoin method semiJoinWithDistinctAsFilteringSource.
private static PlanNode semiJoinWithDistinctAsFilteringSource(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.singleGroupingSet(rightKey).source(p.values(rightKey))));
}
use of io.prestosql.spi.plan.PlanNode in project hetu-core by openlookeng.
the class ValuesMatcher method detailMatches.
@Override
public MatchResult detailMatches(PlanNode node, StatsProvider stats, Session session, Metadata metadata, SymbolAliases symbolAliases) {
checkState(shapeMatches(node), "Plan testing framework error: shapeMatches returned false in detailMatches in %s", this.getClass().getName());
ValuesNode valuesNode = (ValuesNode) node;
if (!expectedRows.map(rows -> rows.equals(valuesNode.getRows().stream().map(rowExpressions -> rowExpressions.stream().map(rowExpression -> {
if (isExpression(rowExpression)) {
return castToExpression(rowExpression);
}
ConstantExpression expression = (ConstantExpression) rowExpression;
if (expression.getType().getJavaType() == boolean.class) {
return new BooleanLiteral(String.valueOf(expression.getValue()));
}
if (expression.getType().getJavaType() == long.class) {
return new LongLiteral(String.valueOf(expression.getValue()));
}
if (expression.getType().getJavaType() == double.class) {
return new DoubleLiteral(String.valueOf(expression.getValue()));
}
if (expression.getType().getJavaType() == Slice.class) {
return new StringLiteral(String.valueOf(expression.getValue()));
}
return new GenericLiteral(expression.getType().toString(), String.valueOf(expression.getValue()));
}).collect(toImmutableList())).collect(toImmutableList()))).orElse(true)) {
return NO_MATCH;
}
return match(SymbolAliases.builder().putAll(Maps.transformValues(outputSymbolAliases, index -> toSymbolReference(valuesNode.getOutputSymbols().get(index)))).build());
}
Aggregations