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


Java ProjectionPlanNode类代码示例

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


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

示例1: addProjection

import org.voltdb.plannodes.ProjectionPlanNode; //导入依赖的package包/类
/**
 * Given a relatively complete plan-sub-graph, apply a trivial projection
 * (filter) to it. If the root node can embed the projection do so. If not,
 * add a new projection node.
 *
 * @param rootNode
 *            The root of the plan-sub-graph to add the projection to.
 * @return The new root of the plan-sub-graph (might be the same as the
 *         input).
 */
private AbstractPlanNode addProjection(AbstractPlanNode rootNode) {
    assert (m_parsedSelect != null);
    assert (m_parsedSelect.m_displayColumns != null);

    ProjectionPlanNode projectionNode =
        new ProjectionPlanNode();

    // Build the output schema for the projection based on the display columns
    NodeSchema proj_schema = m_parsedSelect.getFinalProjectionSchema();
    projectionNode.setOutputSchemaWithoutClone(proj_schema);

    // if the projection can be done inline...
    if (rootNode instanceof AbstractScanPlanNode) {
        rootNode.addInlinePlanNode(projectionNode);
        return rootNode;
    } else {
        projectionNode.addAndLinkChild(rootNode);
        return projectionNode;
    }
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:31,代码来源:PlanAssembler.java

示例2: testEng4792PlanWithCompoundEQLTEOrderedByPK

import org.voltdb.plannodes.ProjectionPlanNode; //导入依赖的package包/类
public void testEng4792PlanWithCompoundEQLTEOrderedByPK() throws JSONException
{
    AbstractPlanNode pn = compile("select id from a where deleted=? and updated_date <= ? order by id limit ?;");
    // System.out.println("DEBUG: " + pn.toExplainPlanString());
    pn = pn.getChild(0);
    // ENG-5066: now Limit is pushed under Projection
    assertTrue(pn instanceof ProjectionPlanNode);
    pn = pn.getChild(0);
    // inline limit with order by
    assertTrue(pn instanceof OrderByPlanNode);
    assertNotNull(pn.getInlinePlanNode(PlanNodeType.LIMIT));

    pn = pn.getChild(0);
    assertTrue(pn instanceof IndexScanPlanNode);
    assertTrue(pn.toJSONString().contains("\"TARGET_INDEX_NAME\":\"DELETED_SINCE_IDX\""));
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:17,代码来源:TestIndexSelection.java

示例3: checkInlineLimitWithOrderby

import org.voltdb.plannodes.ProjectionPlanNode; //导入依赖的package包/类
private void checkInlineLimitWithOrderby(List<AbstractPlanNode> pns, boolean pushdown) {
    AbstractPlanNode p;

    p = pns.get(0).getChild(0);
    assertTrue(p instanceof ProjectionPlanNode);
    p = p.getChild(0);
    assertTrue(p instanceof OrderByPlanNode);
    assertNotNull(p.getInlinePlanNode(PlanNodeType.LIMIT));

    if (pushdown) {
        assertEquals(2, pns.size());
        p = pns.get(1).getChild(0);
        assertTrue(p instanceof OrderByPlanNode);
        assertNotNull(p.getInlinePlanNode(PlanNodeType.LIMIT));
    } else if (pns.size() == 2) {
        p = pns.get(1).getChild(0);
        assertFalse(p.toExplainPlanString().toLowerCase().contains("limit"));
    }
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:20,代码来源:TestPlansLimit.java

示例4: testInlineSerialAgg_noGroupBy_special

import org.voltdb.plannodes.ProjectionPlanNode; //导入依赖的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

示例5: testComplexAggwithLimit

import org.voltdb.plannodes.ProjectionPlanNode; //导入依赖的package包/类
public void testComplexAggwithLimit() {
    pns = compileToFragments("SELECT A1, sum(A1), sum(A1)+11 FROM P1 GROUP BY A1 ORDER BY A1 LIMIT 2");
    checkHasComplexAgg(pns);

    // Test limit is not pushed down
    AbstractPlanNode p = pns.get(0).getChild(0);
    assertTrue(p instanceof OrderByPlanNode);
    assertNotNull(p.getInlinePlanNode(PlanNodeType.LIMIT));
    assertTrue(p.getChild(0) instanceof ProjectionPlanNode);
    assertTrue(p.getChild(0).getChild(0) instanceof AggregatePlanNode);

    p = pns.get(1).getChild(0);
    // inline limit with order by
    assertTrue(p instanceof OrderByPlanNode);
    assertNotNull(p.getInlinePlanNode(PlanNodeType.LIMIT));
    p = p.getChild(0);
    // inline aggregate
    assertTrue(p instanceof AbstractScanPlanNode);
    assertNotNull(p.getInlinePlanNode(PlanNodeType.HASHAGGREGATE));

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

示例6: checkOptimizedAgg

import org.voltdb.plannodes.ProjectionPlanNode; //导入依赖的package包/类
private void checkOptimizedAgg (List<AbstractPlanNode> pns, boolean optimized) {
    AbstractPlanNode p = pns.get(0).getChild(0);
    if (optimized) {
        assertTrue(p instanceof ProjectionPlanNode);
        assertTrue(p.getChild(0) instanceof AggregatePlanNode);

        p = pns.get(1).getChild(0);
        // push down for optimization
        assertTrue(p instanceof AbstractScanPlanNode);

        assertTrue(p.getInlinePlanNode(PlanNodeType.AGGREGATE) != null ||
                p.getInlinePlanNode(PlanNodeType.HASHAGGREGATE) != null);
    } else {
        assertTrue(pns.size() == 1);
        assertTrue(p instanceof AbstractScanPlanNode);
        assertTrue(p.getInlinePlanNode(PlanNodeType.AGGREGATE) != null ||
                p.getInlinePlanNode(PlanNodeType.HASHAGGREGATE) != null);
    }
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:20,代码来源:TestPlansGroupBy.java

示例7: testUnOptimizedAVG

import org.voltdb.plannodes.ProjectionPlanNode; //导入依赖的package包/类
public void testUnOptimizedAVG() {
    pns = compileToFragments("SELECT AVG(A1) FROM R1");
    checkOptimizedAgg(pns, false);

    pns = compileToFragments("SELECT A1, AVG(PKEY) FROM R1 GROUP BY A1");
    checkOptimizedAgg(pns, false);

    pns = compileToFragments("SELECT A1, AVG(PKEY)+1 FROM R1 GROUP BY A1");
    checkHasComplexAgg(pns);
    AbstractPlanNode p = pns.get(0).getChild(0);
    assertTrue(p instanceof ProjectionPlanNode);
    p = p.getChild(0);
    assertTrue(p instanceof AbstractScanPlanNode);
    assertTrue(p.getInlinePlanNode(PlanNodeType.AGGREGATE) != null ||
            p.getInlinePlanNode(PlanNodeType.HASHAGGREGATE) != null);
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:17,代码来源:TestPlansGroupBy.java

示例8: getOutputColumnIdsForPlanNode

import org.voltdb.plannodes.ProjectionPlanNode; //导入依赖的package包/类
/**
 * @param node
 * @return
 */
public static Collection<Integer> getOutputColumnIdsForPlanNode(AbstractPlanNode node) {
    final Collection<Integer> planColumnIds = new ListOrderedSet<Integer>();

    // 2011-07-20: Using the AbstractExpressions is the more accurate way of
    // getting the
    // Columns referenced in the output
    // If this is Scan that has an inline Projection, grab those too
    if ((node instanceof AbstractScanPlanNode) && node.getInlinePlanNode(PlanNodeType.PROJECTION) != null) {
        ProjectionPlanNode prj_node = node.getInlinePlanNode(PlanNodeType.PROJECTION);
        planColumnIds.addAll(prj_node.getOutputColumnGUIDs());
        if (debug.val)
            LOG.debug(prj_node.getPlanNodeType() + ": " + planColumnIds);
    } else {
        planColumnIds.addAll(node.getOutputColumnGUIDs());
        if (debug.val)
            LOG.debug(node.getPlanNodeType() + ": " + planColumnIds);
    }

    // If this is an AggregatePlanNode, then we also need to include columns
    // computed in the aggregates
    if (node instanceof AggregatePlanNode) {
        AggregatePlanNode agg_node = (AggregatePlanNode) node;
        planColumnIds.addAll(agg_node.getAggregateColumnGuids());
        if (debug.val)
            LOG.debug(node.getPlanNodeType() + ": " + agg_node.getAggregateColumnGuids());
    }

    return (planColumnIds);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:34,代码来源:PlanNodeUtil.java

示例9: getFirstProjection

import org.voltdb.plannodes.ProjectionPlanNode; //导入依赖的package包/类
private ProjectionPlanNode getFirstProjection(final AbstractPlanNode root) {
    final ProjectionPlanNode proj_node[] = { null };
    new PlanNodeTreeWalker(true) {
        @Override
        protected void callback(AbstractPlanNode element) {
            if (element != root && element instanceof ProjectionPlanNode) {
                proj_node[0] = (ProjectionPlanNode) element;
                this.stop();
            }
        }
    }.traverse(root);
    return (proj_node[0]);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:14,代码来源:RemoveRedundantProjectionsOptimizations.java

示例10: testGetPlanNodes

import org.voltdb.plannodes.ProjectionPlanNode; //导入依赖的package包/类
/**
 * testGetPlanNodes
 */
public void testGetPlanNodes() throws Exception {
    PlannerContext cntxt = new PlannerContext();
    AbstractPlanNode root_node = new ProjectionPlanNode(cntxt, 1);
    root_node.addAndLinkChild(new SeqScanPlanNode(cntxt, 2));
    
    Collection<SeqScanPlanNode> found0 = PlanNodeUtil.getPlanNodes(root_node, SeqScanPlanNode.class);
    assertFalse(found0.isEmpty());
    
    Collection<AbstractScanPlanNode> found1 = PlanNodeUtil.getPlanNodes(root_node, AbstractScanPlanNode.class);
    assertFalse(found1.isEmpty());
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:15,代码来源:TestPlanNodeUtil.java

示例11: testSingleProjection

import org.voltdb.plannodes.ProjectionPlanNode; //导入依赖的package包/类
/**
 * testSingleProjection
 */
@Test
public void testSingleProjection() throws Exception {
    Procedure catalog_proc = this.getProcedure("SingleProjection");
    Statement catalog_stmt = this.getStatement(catalog_proc, "sql");
    this.check(catalog_stmt);

    // Grab the root node of the multi-partition query plan tree for this
    // Statement
    AbstractPlanNode root = PlanNodeUtil.getRootPlanNodeForStatement(catalog_stmt, false);
    assertNotNull(root);
    // First check that our single scan node has an inline Projection
    Collection<AbstractScanPlanNode> scan_nodes = PlanNodeUtil.getPlanNodes(root, AbstractScanPlanNode.class);
    assertEquals(1, scan_nodes.size());
    AbstractScanPlanNode scan_node = CollectionUtil.first(scan_nodes);
    assertNotNull(scan_node);
    assertEquals(1, scan_node.getInlinePlanNodes().size());

    // Get the Projection and make sure it has valid output columns
    ProjectionPlanNode inline_proj = (ProjectionPlanNode) scan_node.getInlinePlanNodes().get(PlanNodeType.PROJECTION);
    assertNotNull(inline_proj);
    for (int column_guid : inline_proj.getOutputColumnGUIDs()) {
        PlanColumn column = PlannerContext.singleton().get(column_guid);
        // System.err.println(String.format("[%02d] %s", column_guid,
        // column));
        // System.err.println("==================");
        // System.err.println(PlannerContext.singleton().debug());
        assertNotNull("Invalid PlanColumn [guid=" + column_guid + "]", column);
        assertEquals(column_guid, column.guid());
    } // FOR

    // Now check to make sure there are no other Projections in the tree
    Collection<ProjectionPlanNode> proj_nodes = PlanNodeUtil.getPlanNodes(root, ProjectionPlanNode.class);
    assertEquals(0, proj_nodes.size());
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:38,代码来源:TestPlanOptimizer.java

示例12: processComplexAggProjectionNode

import org.voltdb.plannodes.ProjectionPlanNode; //导入依赖的package包/类
private AbstractPlanNode processComplexAggProjectionNode(
        ParsedSelectStmt selectStmt, AbstractPlanNode root) {
    if (! selectStmt.hasComplexAgg()) {
        return root;
    }

    ProjectionPlanNode proj = new ProjectionPlanNode();
    proj.setOutputSchema(selectStmt.getFinalProjectionSchema());

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

示例13: isValidAggregateNodeForLimitPushdown

import org.voltdb.plannodes.ProjectionPlanNode; //导入依赖的package包/类
private static boolean isValidAggregateNodeForLimitPushdown(AbstractPlanNode aggregateNode,
        List<ParsedColInfo> orderBys, boolean orderByCoversAllGroupBy) {
    if (aggregateNode instanceof AggregatePlanNode == false) {
        return false;
    }
    if (aggregateNode.getParentCount() == 0) {
        return false;
    }

    // Limitation: can only push past coordinating aggregation nodes
    if (!((AggregatePlanNode)aggregateNode).m_isCoordinatingAggregator) {
        return false;
    }

    AbstractPlanNode parent = aggregateNode.getParent(0);
    AbstractPlanNode orderByNode = null;
    if (parent instanceof OrderByPlanNode) {
        orderByNode = parent;
    } else if ( parent instanceof ProjectionPlanNode &&
         parent.getParentCount() > 0 &&
         parent.getParent(0) instanceof OrderByPlanNode) {
        // Xin really wants inline project with aggregation

        orderByNode = parent.getParent(0);
    }

    if (orderByNode == null) {
        // When aggregate without order by and group by columns does not contain partition column,
        // Limit should not be pushed down.
        // Remember, when group by partition column, there will not be top aggregate plan node.
        return false;
    }

    if (! orderByCoversAllGroupBy || isOrderByAggregationValue(orderBys)) {
        return false;
    }

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

示例14: testSelfUnion

import org.voltdb.plannodes.ProjectionPlanNode; //导入依赖的package包/类
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 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");
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:34,代码来源:TestUnion.java

示例15: checkReverseScan

import org.voltdb.plannodes.ProjectionPlanNode; //导入依赖的package包/类
private void checkReverseScan(String indexName, IndexLookupType lookupType,
        int searchKeys, int endKeys, int predicates, int initials, boolean artificial,
        SortDirectionType sortType, boolean needOrderby) {

    AbstractPlanNode pn = compile(sql);
    System.out.println(pn.toExplainPlanString());

    assertTrue(pn instanceof SendPlanNode);
    pn = pn.getChild(0);
    if (needOrderby) {
        assertTrue(pn instanceof ProjectionPlanNode);
        pn = pn.getChild(0);
        assertTrue(pn instanceof OrderByPlanNode);
        pn = pn.getChild(0);
    }
    assertTrue(pn instanceof IndexScanPlanNode);

    IndexScanPlanNode ispn = (IndexScanPlanNode)pn;
    assertTrue(ispn.getTargetIndexName().contains(indexName));
    assertEquals(lookupType, ispn.getLookupType());
    assertEquals(searchKeys, ispn.getSearchKeyExpressions().size());
    assertEquals(endKeys, ExpressionUtil.uncombine(ispn.getEndExpression()).size());
    assertEquals(predicates, ExpressionUtil.uncombine(ispn.getPredicate()).size());

    assertEquals(initials, ExpressionUtil.uncombine(ispn.getInitialExpression()).size());

    // Test artificial post predicate
    if (predicates == 1 && artificial) {
        assertTrue(ispn.getPredicate().getExpressionType() == ExpressionType.OPERATOR_NOT);
        assertTrue(ispn.getPredicate().getLeft().getExpressionType() == ExpressionType.OPERATOR_IS_NULL);
    } else if (predicates > 1) {
        assertTrue(ispn.getPredicate().getExpressionType() == ExpressionType.CONJUNCTION_AND);
    }

    // SortDirection can be INVALID because we use LookupType to determine
    // index scan direction instead in EE.
    assertEquals(sortType, ispn.getSortDirection());
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:39,代码来源:TestIndexReverseScan.java


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