当前位置: 首页>>代码示例>>Java>>正文


Java NestLoopIndexPlanNode类代码示例

本文整理汇总了Java中org.voltdb.plannodes.NestLoopIndexPlanNode的典型用法代码示例。如果您正苦于以下问题:Java NestLoopIndexPlanNode类的具体用法?Java NestLoopIndexPlanNode怎么用?Java NestLoopIndexPlanNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NestLoopIndexPlanNode类属于org.voltdb.plannodes包,在下文中一共展示了NestLoopIndexPlanNode类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: injectIndexedJoinWithMaterializedScan

import org.voltdb.plannodes.NestLoopIndexPlanNode; //导入依赖的package包/类
private static AbstractPlanNode injectIndexedJoinWithMaterializedScan(AbstractExpression listElements,
                                                               IndexScanPlanNode scanNode)
{
    MaterializedScanPlanNode matScan = new MaterializedScanPlanNode();
    assert(listElements instanceof VectorValueExpression || listElements instanceof ParameterValueExpression);
    matScan.setRowData(listElements);
    matScan.setSortDirection(scanNode.getSortDirection());

    NestLoopIndexPlanNode nlijNode = new NestLoopIndexPlanNode();
    nlijNode.setJoinType(JoinType.INNER);
    nlijNode.addInlinePlanNode(scanNode);
    nlijNode.addAndLinkChild(matScan);
    // resolve the sort direction
    nlijNode.resolveSortDirection();
    return nlijNode;
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:17,代码来源:SubPlanAssembler.java

示例2: testEng3850ComplexIndexablePlan

import org.voltdb.plannodes.NestLoopIndexPlanNode; //导入依赖的package包/类
public void testEng3850ComplexIndexablePlan()
    {
        AbstractPlanNode pn = compile("select id from a, t where a.id < (t.a + ?);");
        pn = pn.getChild(0);
        pn = pn.getChild(0);
//        System.out.println("DEBUG: " + pn.toExplainPlanString());
        assertTrue(pn instanceof NestLoopIndexPlanNode);
        IndexScanPlanNode indexScan = (IndexScanPlanNode)pn.getInlinePlanNode(PlanNodeType.INDEXSCAN);
        assertEquals(IndexLookupType.LT, indexScan.getLookupType());
        assertTrue(indexScan.toJSONString().contains("\"TARGET_INDEX_NAME\":\"" +
                HSQLInterface.AUTO_GEN_CONSTRAINT_WRAPPER_PREFIX + "ID"));
        pn = pn.getChild(0);
        assertTrue(pn instanceof SeqScanPlanNode);
//        System.out.println("DEBUG: " + pn.toJSONString());
        assertTrue(pn.toJSONString().contains("\"TARGET_TABLE_NAME\":\"T\""));
    }
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:17,代码来源:TestIndexSelection.java

示例3: testBasicThreeTableInnerJoin

import org.voltdb.plannodes.NestLoopIndexPlanNode; //导入依赖的package包/类
public void testBasicThreeTableInnerJoin() {
    AbstractPlanNode pn = compile("select * FROM R1 JOIN R2 ON R1.C = R2.C JOIN R3 ON R3.C = R2.C");
    AbstractPlanNode n = pn.getChild(0).getChild(0);
    assertTrue(n instanceof NestLoopPlanNode);
    assertTrue(n.getChild(0) instanceof NestLoopPlanNode);
    assertTrue(n.getChild(1) instanceof SeqScanPlanNode);
    assertEquals(7, pn.getOutputSchema().getColumns().size());

    pn = compile("select R1.C, R2.C R3.C FROM R1 INNER JOIN R2 ON R1.C = R2.C INNER JOIN R3 ON R3.C = R2.C");
    n = pn.getChild(0).getChild(0);
    assertTrue(n instanceof NestLoopPlanNode);
    assertTrue(n.getChild(0) instanceof NestLoopPlanNode);
    assertTrue(n.getChild(1) instanceof SeqScanPlanNode);

    pn = compile("select C FROM R1 INNER JOIN R2 USING (C) INNER JOIN R3 USING(C)");
    n = pn.getChild(0).getChild(0);
    assertTrue(n instanceof NestLoopPlanNode);
    assertTrue(n.getChild(0) instanceof NestLoopPlanNode);
    assertTrue(n.getChild(1) instanceof SeqScanPlanNode);
    assertEquals(1, pn.getOutputSchema().getColumns().size());

    pn = compile("select C FROM R1 INNER JOIN R2 USING (C), R3 WHERE R1.A = R3.A");
    n = pn.getChild(0).getChild(0);
    assertTrue(n instanceof NestLoopPlanNode);
    assertTrue(n.getChild(0) instanceof NestLoopIndexPlanNode);
    assertTrue(n.getChild(1) instanceof SeqScanPlanNode);
    assertEquals(1, pn.getOutputSchema().getColumns().size());

    failToCompile("select C, R3.C FROM R1 INNER JOIN R2 USING (C) INNER JOIN R3 ON R1.C = R3.C",
                  "user lacks privilege or object not found: R1.C");
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:32,代码来源:TestPlansJoin.java

示例4: testMultitableDistributedJoin

import org.voltdb.plannodes.NestLoopIndexPlanNode; //导入依赖的package包/类
public void testMultitableDistributedJoin() {
  // One distributed table
  List<AbstractPlanNode> lpn = compileToFragments("select *  FROM R3,R1 LEFT JOIN P2 ON R3.A = P2.A WHERE R3.A=R1.A ");
  assertTrue(lpn.size() == 2);
  AbstractPlanNode n = lpn.get(0).getChild(0).getChild(0);
  assertTrue(n instanceof NestLoopPlanNode);
  assertTrue(JoinType.LEFT == ((NestLoopPlanNode) n).getJoinType());
  AbstractPlanNode c = n.getChild(0);
  assertTrue(c instanceof NestLoopIndexPlanNode);

  // R3.A and P2.A have an index. P2,R1 is NLIJ/inlined IndexScan because it's an inner join even P2 is distributed
  lpn = compileToFragments("select *  FROM P2,R1 LEFT JOIN R3 ON R3.A = P2.A WHERE P2.A=R1.A ");
  assertTrue(lpn.size() == 2);
  n = lpn.get(0).getChild(0).getChild(0);
  assertTrue(n instanceof ReceivePlanNode);
  n = lpn.get(1).getChild(0);
  assertTrue(n instanceof NestLoopIndexPlanNode);
  assertTrue(JoinType.LEFT == ((NestLoopIndexPlanNode) n).getJoinType());
  c = n.getChild(0);
  assertTrue(c instanceof NestLoopIndexPlanNode);

  // R3.A has an index. R3,P2 is NLJ because it's an outer join and P2 is distributed
  lpn = compileToFragments("select *  FROM R3,R1 LEFT JOIN P2 ON R3.A = P2.A WHERE R3.A=R1.A ");
  assertTrue(lpn.size() == 2);
  // to debug */ System.out.println("DEBUG 0.0: " + lpn.get(0).toExplainPlanString());
  // to debug */ System.out.println("DEBUG 0.1: " + lpn.get(1).toExplainPlanString());
  n = lpn.get(0).getChild(0).getChild(0);
  assertTrue(n instanceof NestLoopPlanNode);
  assertTrue(JoinType.LEFT == ((NestLoopPlanNode) n).getJoinType());
  c = n.getChild(0);
  assertTrue(c instanceof NestLoopIndexPlanNode);
  assertTrue(JoinType.INNER == ((NestLoopIndexPlanNode) c).getJoinType());
  c = n.getChild(1);
  assertTrue(c instanceof ReceivePlanNode);
  n = lpn.get(1).getChild(0);
  // For determinism reason
  assertTrue(n instanceof IndexScanPlanNode);

  // R3.A has an index. P2,R1 is NLJ because P2 is distributed and it's an outer join
  lpn = compileToFragments("select *  FROM R1 LEFT JOIN P2 ON R1.A = P2.A, R3 WHERE R1.A=R3.A ");
  assertTrue(lpn.size() == 2);
  // to debug */ System.out.println("DEBUG 1.0: " + lpn.get(0).toExplainPlanString());
  // to debug */ System.out.println("DEBUG 1.1: " + lpn.get(1).toExplainPlanString());
  n = lpn.get(0).getChild(0).getChild(0);
  assertTrue(n instanceof NestLoopIndexPlanNode);
  assertTrue(JoinType.INNER == ((NestLoopIndexPlanNode) n).getJoinType());
  n = n.getChild(0);
  assertTrue(n instanceof NestLoopPlanNode);
  c = n.getChild(0);
  assertTrue(c instanceof SeqScanPlanNode);
  c = n.getChild(1);
  assertTrue(c instanceof ReceivePlanNode);
  n = lpn.get(1).getChild(0);
  // For determinism reason
  assertTrue(n instanceof IndexScanPlanNode);

  // Two distributed table
  lpn = compileToFragments("select *  FROM R3,P1 LEFT JOIN P2 ON R3.A = P2.A WHERE R3.A=P1.A ");
  assertTrue(lpn.size() == 2);
  n = lpn.get(0).getChild(0).getChild(0);
  assertTrue(n instanceof ReceivePlanNode);
  n = lpn.get(1).getChild(0);
  assertTrue(JoinType.LEFT == ((NestLoopIndexPlanNode) n).getJoinType());
  c = n.getChild(0);
  assertTrue(c instanceof NestLoopIndexPlanNode);
  assertTrue(JoinType.INNER == ((NestLoopIndexPlanNode) c).getJoinType());
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:68,代码来源:TestMultipleOuterJoinPlans.java

示例5: testDistributedIndexJoinConditions

import org.voltdb.plannodes.NestLoopIndexPlanNode; //导入依赖的package包/类
public void testDistributedIndexJoinConditions() {
    // Distributed outer table, replicated inner -NLIJ/inlined IndexScan
    List<AbstractPlanNode> lpn;
    //AbstractPlanNode pn;
    AbstractPlanNode n;
    lpn = compileToFragments("select * FROM P1 LEFT JOIN R3 ON P1.C = R3.A");
    assertEquals(2, lpn.size());
    n = lpn.get(1).getChild(0);
    assertTrue(n instanceof NestLoopIndexPlanNode);
    assertEquals(1, n.getChildCount());
    assertTrue(n.getChild(0) instanceof SeqScanPlanNode);

    // Distributed inner  and replicated outer tables -NLJ/IndexScan
    lpn = compileToFragments("select *  FROM R3 LEFT JOIN P2 ON R3.A = P2.A AND P2.A < 0 AND P2.E > 3 WHERE P2.A IS NULL");
    assertEquals(2, lpn.size());
    for (AbstractPlanNode apn: lpn) {
        System.out.println(apn.toExplainPlanString());
    }

    n = lpn.get(0).getChild(0).getChild(0);
    assertTrue(n instanceof NestLoopPlanNode);
    assertEquals(JoinType.LEFT, ((NestLoopPlanNode) n).getJoinType());
    assertNotNull(((NestLoopPlanNode) n).getJoinPredicate());
    assertNotNull(((NestLoopPlanNode) n).getWherePredicate());
    AbstractPlanNode c = n.getChild(0);
    assertTrue(c instanceof SeqScanPlanNode);
    c = n.getChild(1);
    assertTrue(c instanceof ReceivePlanNode);
    n = lpn.get(1).getChild(0);
    assertTrue(n instanceof IndexScanPlanNode);
    IndexScanPlanNode in = (IndexScanPlanNode) n;
    assertEquals(IndexLookupType.LT, in.getLookupType());

    assertNotNull(in.getPredicate());
    assertEquals(ExpressionType.CONJUNCTION_AND, in.getPredicate().getExpressionType());
    assertEquals(ExpressionType.COMPARE_GREATERTHAN, in.getPredicate().getLeft().getExpressionType());
    assertEquals(ExpressionType.OPERATOR_NOT, in.getPredicate().getRight().getExpressionType());

    // Distributed inner  and outer tables -NLIJ/inlined IndexScan
    lpn = compileToFragments("select *  FROM P2 RIGHT JOIN P3 ON P3.A = P2.A AND P2.A < 0 WHERE P2.A IS NULL");
    assertEquals(2, lpn.size());
    n = lpn.get(1).getChild(0);
    assertTrue(n instanceof NestLoopIndexPlanNode);
    assertEquals(JoinType.LEFT, ((NestLoopIndexPlanNode) n).getJoinType());
    assertNull(((NestLoopIndexPlanNode) n).getJoinPredicate());
    assertNotNull(((NestLoopIndexPlanNode) n).getWherePredicate());
    AbstractExpression w = ((NestLoopIndexPlanNode) n).getWherePredicate();
    assertEquals(ExpressionType.OPERATOR_IS_NULL, w.getExpressionType());
    IndexScanPlanNode indexScan = (IndexScanPlanNode)n.getInlinePlanNode(PlanNodeType.INDEXSCAN);
    assertEquals(IndexLookupType.EQ, indexScan.getLookupType());
    assertEquals(ExpressionType.COMPARE_EQUAL, indexScan.getEndExpression().getExpressionType());
    w = indexScan.getPredicate();
    assertNotNull(w);
    assertEquals(ExpressionType.COMPARE_LESSTHAN, w.getExpressionType());
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:56,代码来源:TestPlansJoin.java


注:本文中的org.voltdb.plannodes.NestLoopIndexPlanNode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。