use of org.voltdb.plannodes.SeqScanPlanNode in project voltdb by VoltDB.
the class TestWindowedFunctions method validatePartitionedQuery.
private void validatePartitionedQuery(String query, boolean hasStatementOrderBy) {
List<AbstractPlanNode> nodes = compileToFragments(query);
assertEquals(2, nodes.size());
AbstractPlanNode child = nodes.get(0);
// Validate the coordinator fragment.
assertTrue(child instanceof SendPlanNode);
child = child.getChild(0);
assertTrue(child instanceof ProjectionPlanNode);
if (hasStatementOrderBy) {
child = child.getChild(0);
assertTrue(child instanceof OrderByPlanNode);
}
child = child.getChild(0);
assertTrue(child instanceof WindowFunctionPlanNode);
child = child.getChild(0);
assertTrue(child instanceof OrderByPlanNode);
child = child.getChild(0);
assertTrue(child instanceof ReceivePlanNode);
assertEquals(0, child.getChildCount());
// Get the distributed fragment.
child = nodes.get(1);
assertTrue(child instanceof SendPlanNode);
child = child.getChild(0);
assertTrue(child instanceof SeqScanPlanNode);
assertEquals(0, child.getChildCount());
}
use of org.voltdb.plannodes.SeqScanPlanNode in project voltdb by VoltDB.
the class TestUnion method testSelfUnion.
public void testSelfUnion() {
AbstractPlanNode pn = compile("select B from T2 UNION select B from T2");
assertTrue(pn.getChild(0) instanceof UnionPlanNode);
pn = pn.getChild(0);
assertTrue(pn.getChildCount() == 2);
assertTrue(pn.getChild(0) instanceof SeqScanPlanNode);
assertTrue(pn.getChild(1) instanceof SeqScanPlanNode);
// The same table/alias is repeated twice in the union but in the different selects
pn = compile("select A1.B from T2 A1, T2 A2 WHERE A1.B = A2.B UNION select B from T2 A1");
assertTrue(pn.getChild(0) instanceof UnionPlanNode);
pn = pn.getChild(0);
assertTrue(pn.getChildCount() == 2);
assertTrue(pn.getChild(0) instanceof ProjectionPlanNode);
assertTrue(pn.getChild(0).getChild(0) instanceof NestLoopPlanNode);
assertTrue(pn.getChild(1) instanceof SeqScanPlanNode);
// BOTH sides are single-partitioned for the same partition
pn = compile("select F from T1 WHERE T1.A = 2 UNION select F from T1 WHERE T1.A = 2");
assertTrue(pn.getChild(0) instanceof UnionPlanNode);
// If BOTH sides are single-partitioned, but for different partitions,
// it would theoretically be possible to satisfy
// the query with a 2-fragment plan IFF the coordinator fragment could be forced to
// execute on one of the designated single partitions.
// At this point, coordinator designation is only supported for single-fragment plans.
failToCompile("select DESC from T1 WHERE A = 1 UNION select DESC from T1 WHERE A = 2");
// If both sides are multi-partitioned, there is no facility for pushing down the
// union processing below the send/receive, so each child of the union requires
// its own send/receive so the plan ends up as an unsupported 3-fragment plan.
failToCompile("select DESC from T1 UNION select DESC from T1");
}
use of org.voltdb.plannodes.SeqScanPlanNode in project voltdb by VoltDB.
the class TestPlansGroupBy method testDistinctA1_Subquery.
public void testDistinctA1_Subquery() {
AbstractPlanNode p;
List<AbstractPlanNode> pns;
// Distinct rewrote with group by
pns = compileToFragments("select * from (SELECT DISTINCT A1 FROM T1) temp");
p = pns.get(0).getChild(0);
assertTrue(p instanceof SeqScanPlanNode);
assertTrue(p.getChild(0) instanceof HashAggregatePlanNode);
assertTrue(p.getChild(0).getChild(0) instanceof ReceivePlanNode);
p = pns.get(1).getChild(0);
assertTrue(p instanceof AbstractScanPlanNode);
assertNotNull(p.getInlinePlanNode(PlanNodeType.HASHAGGREGATE));
}
use of org.voltdb.plannodes.SeqScanPlanNode in project voltdb by VoltDB.
the class TestIndexSelection method testEng3850ComplexIndexablePlan.
// This tests recognition of a complex expression value
// -- an addition -- used as an indexable join key's search key value.
// Some time ago, this would throw a casting error in the planner.
public void testEng3850ComplexIndexablePlan() {
AbstractPlanNode pn = compile("select id from a, t where a.id < (t.a + ?);");
pn = pn.getChild(0);
pn = pn.getChild(0);
//*enable to debug*/System.out.println("DEBUG: " + pn.toExplainPlanString());
assertTrue(pn instanceof NestLoopIndexPlanNode);
IndexScanPlanNode indexScan = ((NestLoopIndexPlanNode) pn).getInlineIndexScan();
assertEquals(IndexLookupType.LT, indexScan.getLookupType());
assertEquals(HSQLInterface.AUTO_GEN_NAMED_CONSTRAINT_IDX + "ID", indexScan.getTargetIndexName());
pn = pn.getChild(0);
assertTrue(pn instanceof SeqScanPlanNode);
SeqScanPlanNode sspn = (SeqScanPlanNode) pn;
//*enable to debug*/System.out.println("DEBUG: " + pn.toJSONString());
assertEquals("T", sspn.getTargetTableName());
}
use of org.voltdb.plannodes.SeqScanPlanNode in project voltdb by VoltDB.
the class TestJoinOrder method testMicroOptimizationJoinOrder.
public void testMicroOptimizationJoinOrder() {
// Microoptimization can be used for determinism only when working with replicated tables or
// single-partition queries.
List<AbstractPlanNode> pns;
AbstractPlanNode n;
pns = compileWithJoinOrderToFragments("select * from J1, P2 where A=B and A=1", "J1, P2");
n = pns.get(0).getChild(0).getChild(0);
assertTrue(((IndexScanPlanNode) n.getChild(0)).getTargetTableName().equals("J1"));
assertTrue(((SeqScanPlanNode) n.getChild(1)).getTargetTableName().equals("P2"));
pns = compileWithJoinOrderToFragments("select * from I1, T2 where A=B", "I1, T2");
//* enable to debug */ System.out.println(pns.get(0).toExplainPlanString());
n = pns.get(0).getChild(0).getChild(0);
assertTrue(((IndexScanPlanNode) n.getChild(0)).getTargetTableName().equals("I1"));
assertTrue(((SeqScanPlanNode) n.getChild(1)).getTargetTableName().equals("T2"));
}
Aggregations