use of io.prestosql.spi.plan.ValuesNode in project hetu-core by openlookeng.
the class TestWindowNode method setUp.
@BeforeClass
public void setUp() {
planSymbolAllocator = new PlanSymbolAllocator();
columnA = planSymbolAllocator.newSymbol("a", BIGINT);
columnB = planSymbolAllocator.newSymbol("b", BIGINT);
columnC = planSymbolAllocator.newSymbol("c", BIGINT);
sourceNode = new ValuesNode(newId(), ImmutableList.of(columnA, columnB, columnC), ImmutableList.of());
}
use of io.prestosql.spi.plan.ValuesNode in project hetu-core by openlookeng.
the class TestDistributedExecutionPlanner method testValuesRestart.
@Test
public void testValuesRestart() {
ValuesNode a = values("A");
ValuesNode b = values("B");
SubPlan root = makePlan(1, join(a, b), ImmutableList.of());
planner.plan(root, session, RESUME, null, 7);
assertNull(a.getResumeSnapshotId());
assertEquals(a.getNextSnapshotId(), 7);
assertNull(b.getResumeSnapshotId());
assertEquals(b.getNextSnapshotId(), 7);
}
use of io.prestosql.spi.plan.ValuesNode in project hetu-core by openlookeng.
the class TestVerifyOnlyOneOutputNode method testValidateSuccessful.
@Test
public void testValidateSuccessful() {
// random seemingly valid plan
PlanNode root = new OutputNode(idAllocator.getNextId(), new ProjectNode(idAllocator.getNextId(), new ValuesNode(idAllocator.getNextId(), ImmutableList.of(), ImmutableList.of()), Assignments.of()), ImmutableList.of(), ImmutableList.of());
new VerifyOnlyOneOutputNode().validate(root, null, null, null, null, WarningCollector.NOOP);
}
use of io.prestosql.spi.plan.ValuesNode in project hetu-core by openlookeng.
the class TestVerifyOnlyOneOutputNode method testValidateFailed.
@Test(expectedExceptions = IllegalStateException.class)
public void testValidateFailed() {
// random plan with 2 output nodes
PlanNode root = new OutputNode(idAllocator.getNextId(), new ExplainAnalyzeNode(idAllocator.getNextId(), new OutputNode(idAllocator.getNextId(), new ProjectNode(idAllocator.getNextId(), new ValuesNode(idAllocator.getNextId(), ImmutableList.of(), ImmutableList.of()), Assignments.of()), ImmutableList.of(), ImmutableList.of()), new Symbol("a"), false), ImmutableList.of(), ImmutableList.of());
new VerifyOnlyOneOutputNode().validate(root, null, null, null, null, WarningCollector.NOOP);
}
use of io.prestosql.spi.plan.ValuesNode 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