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


Java ReceivePlanNode类代码示例

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


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

示例1: testInlineSerialAgg_noGroupBy_special

import org.voltdb.plannodes.ReceivePlanNode; //导入依赖的package包/类
public void testInlineSerialAgg_noGroupBy_special() {
  AbstractPlanNode p;
  pns = compileToFragments("SELECT AVG(A1) from T1");
  for (AbstractPlanNode apn: pns) {
      System.out.println(apn.toExplainPlanString());
  }
  p = pns.get(0).getChild(0);
  assertTrue(p instanceof ProjectionPlanNode);
  assertTrue(p.getChild(0) instanceof AggregatePlanNode);
  assertTrue(p.getChild(0).getChild(0) instanceof ReceivePlanNode);

  p = pns.get(1).getChild(0);
  assertTrue(p instanceof SeqScanPlanNode);
  assertNotNull(p.getInlinePlanNode(PlanNodeType.PROJECTION));
  assertNotNull(p.getInlinePlanNode(PlanNodeType.AGGREGATE));
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:17,代码来源:TestPlansGroupBy.java

示例2: reconstructPlanNodeTree

import org.voltdb.plannodes.ReceivePlanNode; //导入依赖的package包/类
/**
 * @param nodes
 * @param singlePartition
 *            TODO
 * @return
 */
public static AbstractPlanNode reconstructPlanNodeTree(Statement catalog_stmt, List<AbstractPlanNode> nodes, boolean singlePartition) throws Exception {
    if (debug.val)
        LOG.debug("reconstructPlanNodeTree(" + catalog_stmt + ", " + nodes + ", true)");

    // HACK: We should have all SendPlanNodes here, so we just need to order
    // them
    // by their Node ids from lowest to highest (where the root has id = 1)
    TreeSet<AbstractPlanNode> sorted_nodes = new TreeSet<AbstractPlanNode>(new Comparator<AbstractPlanNode>() {
        @Override
        public int compare(AbstractPlanNode o1, AbstractPlanNode o2) {
            // o1 < o2
            return o1.getPlanNodeId() - o2.getPlanNodeId();
        }
    });
    sorted_nodes.addAll(nodes);
    if (debug.val)
        LOG.debug("SORTED NODES: " + sorted_nodes);
    AbstractPlanNode last_node = null;
    for (AbstractPlanNode node : sorted_nodes) {
        final AbstractPlanNode walker_last_node = last_node;
        final List<AbstractPlanNode> next_last_node = new ArrayList<AbstractPlanNode>();
        new PlanNodeTreeWalker() {
            @Override
            protected void callback(AbstractPlanNode element) {
                if (element instanceof SendPlanNode && walker_last_node != null) {
                    walker_last_node.addAndLinkChild(element);
                } else if (element instanceof ReceivePlanNode) {
                    assert (next_last_node.isEmpty());
                    next_last_node.add(element);
                }
            }
        }.traverse(node);

        if (!next_last_node.isEmpty())
            last_node = next_last_node.remove(0);
    } // FOR
    return (CollectionUtil.first(sorted_nodes));
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:45,代码来源:PlanNodeUtil.java

示例3: optimize

import org.voltdb.plannodes.ReceivePlanNode; //导入依赖的package包/类
@Override
public Pair<Boolean, AbstractPlanNode> optimize(final AbstractPlanNode root) {
    
    if (root instanceof ReceivePlanNode) {
        // Mark as fast combine
        // System.err.println(PlanNodeUtil.debug(root));
    }
    
    return (Pair.of(true, root));
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:11,代码来源:CombineOptimization.java

示例4: addSendReceivePair

import org.voltdb.plannodes.ReceivePlanNode; //导入依赖的package包/类
/**
 * Insert a send receive pair above the supplied scanNode.
 * @param scanNode that needs to be distributed
 * @return return the newly created receive node (which is linked to the new sends)
 */
protected AbstractPlanNode addSendReceivePair(AbstractPlanNode scanNode) {

    SendPlanNode sendNode = new SendPlanNode(m_context, PlanAssembler.getNextPlanNodeId());
    // this will make the child planfragment be sent to all partitions
    sendNode.isMultiPartition = true;
    sendNode.addAndLinkChild(scanNode);

    ReceivePlanNode recvNode = new ReceivePlanNode(m_context, PlanAssembler.getNextPlanNodeId());
    recvNode.addAndLinkChild(sendNode);

    // receive node requires the schema of its output table
    recvNode.updateOutputColumns(m_db);
    return recvNode;
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:20,代码来源:SubPlanAssembler.java

示例5: removeCoordinatorSendReceivePairRecursive

import org.voltdb.plannodes.ReceivePlanNode; //导入依赖的package包/类
static public AbstractPlanNode removeCoordinatorSendReceivePairRecursive(AbstractPlanNode root,
        AbstractPlanNode current) {
    if (current instanceof ReceivePlanNode) {
        assert(current.getChildCount() == 1);

        AbstractPlanNode child = current.getChild(0);
        assert(child instanceof SendPlanNode);

        assert(child.getChildCount() == 1);
        child = child.getChild(0);
        child.clearParents();
        if (current.getParentCount() == 0) {
            return child;
        } else {
            assert(current.getParentCount() == 1);
            AbstractPlanNode parent = current.getParent(0);
            parent.unlinkChild(current);
            parent.addAndLinkChild(child);
            return root;
        }
    } else if (current.getChildCount() == 1) {
        // This is still a coordinator node
        return removeCoordinatorSendReceivePairRecursive(root, current.getChild(0));
    } else {
        // We are about to branch and leave the coordinator
        return root;
    }
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:29,代码来源:StmtSubqueryScan.java

示例6: fragmentize

import org.voltdb.plannodes.ReceivePlanNode; //导入依赖的package包/类
private static void fragmentize(CompiledPlan plan, ReceivePlanNode recvNode) {
    assert(recvNode.getChildCount() == 1);
    AbstractPlanNode childNode = recvNode.getChild(0);
    assert(childNode instanceof SendPlanNode);
    SendPlanNode sendNode = (SendPlanNode) childNode;

    // disconnect the send and receive nodes
    sendNode.clearParents();
    recvNode.clearChildren();

    plan.subPlanGraph = sendNode;
    return;
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:14,代码来源:QueryPlanner.java

示例7: addSendReceivePair

import org.voltdb.plannodes.ReceivePlanNode; //导入依赖的package包/类
/**
 * Insert a send receive pair above the supplied scanNode.
 * @param scanNode that needs to be distributed
 * @return return the newly created receive node (which is linked to the new sends)
 */
protected static AbstractPlanNode addSendReceivePair(AbstractPlanNode scanNode) {
    SendPlanNode sendNode = new SendPlanNode();
    sendNode.addAndLinkChild(scanNode);

    ReceivePlanNode recvNode = new ReceivePlanNode();
    recvNode.addAndLinkChild(sendNode);

    return recvNode;
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:15,代码来源:SubPlanAssembler.java

示例8: testDistributedInnerJoin

import org.voltdb.plannodes.ReceivePlanNode; //导入依赖的package包/类
public void testDistributedInnerJoin() {
    // JOIN replicated and one distributed table
    AbstractPlanNode pn = compile("select * FROM R1 JOIN P2 ON R1.C = P2.A");
    AbstractPlanNode n = pn.getChild(0).getChild(0);
    assertTrue(n instanceof ReceivePlanNode);

    // Join multiple distributed tables on the partitioned column
    pn = compile("select * FROM P1 JOIN P2 USING(A)");
    n = pn.getChild(0).getChild(0);
    assertTrue(n instanceof ReceivePlanNode);

    // Two Distributed tables join on non-partitioned column
    failToCompile("select * FROM P1 JOIN P2 ON P1.C = P2.E",
                  "Join of multiple partitioned tables has insufficient join criteria.");
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:16,代码来源:TestPlansJoin.java

示例9: testDistributedSeqScanOuterJoinCondition

import org.voltdb.plannodes.ReceivePlanNode; //导入依赖的package包/类
public void testDistributedSeqScanOuterJoinCondition() {
    // Distributed Outer table
    List<AbstractPlanNode> lpn;
    AbstractPlanNode pn;
    AbstractPlanNode n;
    lpn = compileToFragments("select * FROM P1 LEFT JOIN R2 ON P1.C = R2.C");
    assertEquals(2, lpn.size());
    n = lpn.get(1).getChild(0);
    assertTrue(n instanceof NestLoopPlanNode);
    assertEquals(2, n.getChildCount());
    assertTrue(n.getChild(0) instanceof SeqScanPlanNode);
    assertTrue(n.getChild(1) instanceof SeqScanPlanNode);

    // Distributed Inner table
    pn = compile("select * FROM R2 LEFT JOIN P1 ON P1.C = R2.C");
    n = pn.getChild(0).getChild(0);
    assertTrue(n instanceof NestLoopPlanNode);
    NestLoopPlanNode nl = (NestLoopPlanNode) n;
    assertEquals(2, nl.getChildCount());
    assertTrue(nl.getChild(0) instanceof SeqScanPlanNode);
    assertTrue(nl.getChild(1) instanceof ReceivePlanNode);

    // Distributed Inner and Outer table joined on the partition column
    lpn = compileToFragments("select * FROM P1 LEFT JOIN P4 ON P1.A = P4.A");
    assertEquals(2, lpn.size());
    n = lpn.get(1).getChild(0);
    assertTrue(n instanceof NestLoopPlanNode);
    assertEquals(2, n.getChildCount());
    assertTrue(n.getChild(0) instanceof SeqScanPlanNode);
    assertTrue(n.getChild(1) instanceof SeqScanPlanNode);

    // Distributed Inner and Outer table joined on the non-partition column
    failToCompile("select * FROM P1 LEFT JOIN P4 ON P1.A = P4.E",
            "Join of multiple partitioned tables has insufficient join criteria");
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:36,代码来源:TestPlansJoin.java

示例10: testDistributedInnerOuterTable

import org.voltdb.plannodes.ReceivePlanNode; //导入依赖的package包/类
public void testDistributedInnerOuterTable() {
    // Distributed Outer table
    List<AbstractPlanNode> lpn;
    AbstractPlanNode pn;
    AbstractPlanNode n;
    lpn = compileToFragments("select * FROM P1 LEFT JOIN R2 ON P1.C = R2.C");
    assertEquals(2, lpn.size());
    n = lpn.get(1).getChild(0);
    assertTrue(n instanceof NestLoopPlanNode);
    assertEquals(2, n.getChildCount());
    assertTrue(n.getChild(0) instanceof SeqScanPlanNode);
    assertTrue(n.getChild(1) instanceof SeqScanPlanNode);

    // Distributed Inner table
    pn = compile("select * FROM R2 LEFT JOIN P1 ON P1.C = R2.C");
    n = pn.getChild(0).getChild(0);
    assertTrue(n instanceof NestLoopPlanNode);
    NestLoopPlanNode nl = (NestLoopPlanNode) n;
    assertEquals(2, nl.getChildCount());
    assertTrue(nl.getChild(0) instanceof SeqScanPlanNode);
    assertTrue(nl.getChild(1) instanceof ReceivePlanNode);

    // Distributed Inner and Outer table joined on the partition column
    lpn = compileToFragments("select * FROM P1 LEFT JOIN P4 ON P1.A = P4.A");
    assertEquals(2, lpn.size());
    n = lpn.get(1).getChild(0);
    assertTrue(n instanceof NestLoopPlanNode);
    assertEquals(2, n.getChildCount());
    assertTrue(n.getChild(0) instanceof SeqScanPlanNode);
    assertTrue(n.getChild(1) instanceof SeqScanPlanNode);

    // Distributed Inner and Outer table joined on the non-partition column
    failToCompile("select * FROM P1 LEFT JOIN P4 ON P1.A = P4.E",
            "Join of multiple partitioned tables has insufficient join criteria");
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:36,代码来源:TestPlansJoin.java

示例11: checkSimpleTableInlineAgg

import org.voltdb.plannodes.ReceivePlanNode; //导入依赖的package包/类
private void checkSimpleTableInlineAgg(String sql) {
    AbstractPlanNode p;
    pns = compileToFragments(sql);
    p = pns.get(0).getChild(0);
    assertTrue(p instanceof AggregatePlanNode);
    assertTrue(p.getChild(0) instanceof ReceivePlanNode);

    p = pns.get(1).getChild(0);
    assertTrue(p instanceof AbstractScanPlanNode);
    assertNotNull(p.getInlinePlanNode(PlanNodeType.PROJECTION));
    assertNotNull(p.getInlinePlanNode(PlanNodeType.AGGREGATE));
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:13,代码来源:TestPlansGroupBy.java

示例12: testDistinctA1_Subquery

import org.voltdb.plannodes.ReceivePlanNode; //导入依赖的package包/类
public void testDistinctA1_Subquery() {
    AbstractPlanNode p;
    // Distinct rewrote with group by
    pns = compileToFragments("select * from (SELECT DISTINCT A1 FROM T1) temp");
    printExplainPlan(pns);

    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));
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:16,代码来源:TestPlansGroupBy.java

示例13: handleMVBasedMultiPartQuery

import org.voltdb.plannodes.ReceivePlanNode; //导入依赖的package包/类
private AbstractPlanNode handleMVBasedMultiPartQuery (AbstractPlanNode root, boolean edgeCaseOuterJoin) {
    MaterializedViewFixInfo mvFixInfo = m_parsedSelect.m_mvFixInfo;

    HashAggregatePlanNode reAggNode = new HashAggregatePlanNode(mvFixInfo.getReAggregationPlanNode());
    reAggNode.clearChildren();
    reAggNode.clearParents();

    AbstractPlanNode receiveNode = root;
    AbstractPlanNode reAggParent = null;
    // Find receive plan node and insert the constructed re-aggregation plan node.
    if (root.getPlanNodeType() == PlanNodeType.RECEIVE) {
        root = reAggNode;
    } else {
        List<AbstractPlanNode> recList = root.findAllNodesOfType(PlanNodeType.RECEIVE);
        assert(recList.size() == 1);
        receiveNode = recList.get(0);

        reAggParent = receiveNode.getParent(0);
        boolean result = reAggParent.replaceChild(receiveNode, reAggNode);
        assert(result);
    }
    reAggNode.addAndLinkChild(receiveNode);

    assert(receiveNode instanceof ReceivePlanNode);
    AbstractPlanNode sendNode = receiveNode.getChild(0);
    assert(sendNode instanceof SendPlanNode);
    AbstractPlanNode sendNodeChild = sendNode.getChild(0);

    HashAggregatePlanNode reAggNodeForReplace = null;
    if (m_parsedSelect.m_tableList.size() > 1 && !edgeCaseOuterJoin) {
        reAggNodeForReplace = reAggNode;
    }
    boolean find = mvFixInfo.processScanNodeWithReAggNode(sendNode, reAggNodeForReplace);
    assert(find);

    // If it is normal joined query, replace the node under receive node with materialized view scan node.
    if (m_parsedSelect.m_tableList.size() > 1 && !edgeCaseOuterJoin) {
        AbstractPlanNode joinNode = sendNodeChild;
        // No agg, limit pushed down at this point.
        assert(joinNode instanceof AbstractJoinPlanNode);

        // Fix the node after Re-aggregation node.
        joinNode.clearParents();

        assert(mvFixInfo.m_scanNode != null);
        mvFixInfo.m_scanNode.clearParents();

        // replace joinNode with MV scan node on each partition.
        sendNode.clearChildren();
        sendNode.addAndLinkChild(mvFixInfo.m_scanNode);

        // If reAggNode has parent node before we put it under join node,
        // its parent will be the parent of the new join node. Update the root node.
        if (reAggParent != null) {
            reAggParent.replaceChild(reAggNode, joinNode);
            root = reAggParent;
        } else {
            root = joinNode;
        }
    }

    return root;
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:64,代码来源:PlanAssembler.java

示例14: checkLimitPushDownViability

import org.voltdb.plannodes.ReceivePlanNode; //导入依赖的package包/类
/**
 * Check if we can push the limit node down.
 *
 * @param root
 * @return If we can push it down, the send plan node is returned. Otherwise,
 *         it returns null.
 */
protected AbstractPlanNode checkLimitPushDownViability(AbstractPlanNode root) {
    AbstractPlanNode receiveNode = root;

    // Return a mid-plan send node, if one exists and can host a distributed limit node.
    // There is guaranteed to be at most a single receive/send pair.
    // Abort the search if a node that a "limit" can't be pushed past is found before its receive node.
    //
    // Can only push past:
    //   * coordinatingAggregator: a distributed aggregator a copy of which  has already been pushed down.
    //     Distributing a LIMIT to just above that aggregator is correct. (I've got some doubts that this is correct??? --paul)
    //
    //   * order by: if the plan requires a sort, getNextSelectPlan()  will have already added an ORDER BY.
    //     A distributed LIMIT will be added above a copy of that ORDER BY node.
    //
    //   * projection: these have no effect on the application of limits.
    //
    // Return null if the plan is single-partition or if its "coordinator" part contains a push-blocking node type.

    List<ParsedColInfo> orderBys = m_parsedSelect.orderByColumns();
    boolean orderByCoversAllGroupBy = m_parsedSelect.groupByIsAnOrderByPermutation();

    while (!(receiveNode instanceof ReceivePlanNode)) {

        // Limitation: can only push past some nodes (see above comment)
        // Delete the aggregate node case to handle ENG-6485, or say we don't push down meeting aggregate node
        // TODO: We might want to optimize/push down "limit" for some cases
        if (!(receiveNode instanceof OrderByPlanNode) &&
            !(receiveNode instanceof ProjectionPlanNode) &&
            ! isValidAggregateNodeForLimitPushdown(receiveNode, orderBys, orderByCoversAllGroupBy) ) {
            return null;
        }

        if (receiveNode instanceof OrderByPlanNode) {
            // if group by partition key, limit can still push down if ordered by aggregate values.
            if (! m_parsedSelect.hasPartitionColumnInGroupby() &&
                    isOrderByAggregationValue(m_parsedSelect.orderByColumns())) {
                return null;
            }
        }

        // Traverse...
        if (receiveNode.getChildCount() == 0) {
            return null;
        }

        // nothing that allows pushing past has multiple inputs
        assert(receiveNode.getChildCount() == 1);
        receiveNode = receiveNode.getChild(0);
    }
    return receiveNode.getChild(0);
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:59,代码来源:PlanAssembler.java

示例15: testBasicUpdateAndDelete

import org.voltdb.plannodes.ReceivePlanNode; //导入依赖的package包/类
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);

}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:70,代码来源:TestPlansDML.java


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