Ejemplo n.º 1
0
  public void testMultiPartLimitPushdownByOne() {
    List<AbstractPlanNode> pn =
        compileToFragments("select A1, count(*) as tag from T1 group by A1 order by 1 limit 1");

    for (AbstractPlanNode nd : pn) {
      System.out.println("PlanNode Explain string:\n" + nd.toExplainPlanString());
      assertTrue(nd.toExplainPlanString().contains("LIMIT"));
    }
  }
Ejemplo n.º 2
0
 protected String buildExplainPlan(List<AbstractPlanNode> planNodes) {
   String explain = "";
   for (AbstractPlanNode apn : planNodes) {
     explain += apn.toExplainPlanString() + '\n';
   }
   return explain;
 }
Ejemplo n.º 3
0
 @Override
 public String toString() {
   if (rootPlanGraph != null) {
     return "CompiledPlan: \n" + rootPlanGraph.toExplainPlanString();
   } else {
     return "CompiledPlan: [null plan graph]";
   }
 }
Ejemplo n.º 4
0
 protected void printExplainPlan(List<AbstractPlanNode> planNodes) {
   for (AbstractPlanNode apn : planNodes) {
     System.out.println(apn.toExplainPlanString());
   }
 }
Ejemplo n.º 5
0
  public void testBasicUpdateAndDelete() {
    // select * with ON clause should return all columns from all tables
    AbstractPlanNode n;
    AbstractPlanNode pn;

    pns = compileToFragments("UPDATE R1 SET C = 1 WHERE C = 0");
    pn = pns.get(0);
    System.out.println(pn.toExplainPlanString());
    n = pn.getChild(0).getChild(0);
    assertTrue(n instanceof ReceivePlanNode);
    pn = pns.get(1);
    n = pn.getChild(0);
    assertTrue(n instanceof UpdatePlanNode);

    pns = compileToFragments("DELETE FROM R1 WHERE C = 0");
    pn = pns.get(0);
    System.out.println(pn.toExplainPlanString());
    n = pn.getChild(0).getChild(0);
    assertTrue(n instanceof ReceivePlanNode);
    pn = pns.get(1);
    n = pn.getChild(0);
    assertTrue(n instanceof DeletePlanNode);

    pns = compileToFragments("INSERT INTO R1 VALUES (1, 2, 3)");
    pn = pns.get(0);
    System.out.println(pn.toExplainPlanString());
    n = pn.getChild(0).getChild(0);
    assertTrue(n instanceof ReceivePlanNode);
    pn = pns.get(1);
    n = pn.getChild(0);
    assertTrue(n instanceof InsertPlanNode);

    pns = compileToFragments("UPDATE P1 SET C = 1 WHERE C = 0");
    pn = pns.get(0);
    System.out.println(pn.toExplainPlanString());
    n = pn.getChild(0).getChild(0);
    assertTrue(n instanceof ReceivePlanNode);
    pn = pns.get(1);
    n = pn.getChild(0);
    assertTrue(n instanceof UpdatePlanNode);

    pns = compileToFragments("DELETE FROM P1 WHERE C = 0");
    pn = pns.get(0);
    System.out.println(pn.toExplainPlanString());
    n = pn.getChild(0).getChild(0);
    assertTrue(n instanceof ReceivePlanNode);
    pn = pns.get(1);
    n = pn.getChild(0);
    assertTrue(n instanceof DeletePlanNode);

    pns = compileToFragments("UPDATE P1 SET C = 1 WHERE A = 0");
    pn = pns.get(0);
    System.out.println(pn.toExplainPlanString());
    // n = pn.getChild(0);
    assertTrue(pn instanceof UpdatePlanNode);

    pns = compileToFragments("DELETE FROM P1 WHERE A = 0");
    pn = pns.get(0);
    System.out.println(pn.toExplainPlanString());
    // n = pn.getChild(0);
    assertTrue(pn instanceof DeletePlanNode);

    pns = compileToFragments("INSERT INTO P1 VALUES (1, 2)");
    pn = pns.get(0);
    System.out.println(pn.toExplainPlanString());
    // n = pn.getChild(0).getChild(0);
    assertTrue(pn instanceof InsertPlanNode);
  }