本文整理汇总了Java中org.voltdb.plannodes.AbstractJoinPlanNode类的典型用法代码示例。如果您正苦于以下问题:Java AbstractJoinPlanNode类的具体用法?Java AbstractJoinPlanNode怎么用?Java AbstractJoinPlanNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AbstractJoinPlanNode类属于org.voltdb.plannodes包,在下文中一共展示了AbstractJoinPlanNode类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkPushedDownLimit
import org.voltdb.plannodes.AbstractJoinPlanNode; //导入依赖的package包/类
private void checkPushedDownLimit(AbstractPlanNode p, boolean downIntoScan, boolean downIntoJoin, boolean isLeftJoin) {
if (downIntoScan) {
assertTrue(p instanceof AbstractScanPlanNode);
assertTrue(p.getInlinePlanNode(PlanNodeType.LIMIT) != null);
}
if (downIntoJoin) {
assertTrue(p instanceof AbstractJoinPlanNode);
assertTrue(p.getInlinePlanNode(PlanNodeType.LIMIT) != null);
}
if (ENG5399fixed && isLeftJoin) {
assertTrue(p instanceof AbstractJoinPlanNode);
assertTrue(((AbstractJoinPlanNode)p).getJoinType() == JoinType.LEFT);
assertTrue(p.getInlinePlanNode(PlanNodeType.LIMIT) != null);
if (p.getChild(0) instanceof AbstractScanPlanNode || p.getChild(0) instanceof AbstractJoinPlanNode) {
assertTrue(p.getChild(0).getInlinePlanNode(PlanNodeType.LIMIT) != null);
} else {
assertTrue(p.getChild(0).getPlanNodeType() == PlanNodeType.LIMIT);
}
}
}
示例2: getScanExpressionTypes
import org.voltdb.plannodes.AbstractJoinPlanNode; //导入依赖的package包/类
/**
* Return all the ExpressionTypes used for scan predicates in the given PlanNode
* @param node
* @return
*/
public static Collection<ExpressionType> getScanExpressionTypes(AbstractPlanNode root) {
final Set<ExpressionType> found = new HashSet<ExpressionType>();
new PlanNodeTreeWalker(true) {
@Override
protected void callback(AbstractPlanNode node) {
Set<AbstractExpression> exps = new HashSet<AbstractExpression>();
switch (node.getPlanNodeType()) {
// SCANS
case INDEXSCAN: {
IndexScanPlanNode idx_node = (IndexScanPlanNode) node;
exps.add(idx_node.getEndExpression());
exps.addAll(idx_node.getSearchKeyExpressions());
}
case SEQSCAN: {
AbstractScanPlanNode scan_node = (AbstractScanPlanNode) node;
exps.add(scan_node.getPredicate());
break;
}
// JOINS
case NESTLOOP:
case NESTLOOPINDEX: {
AbstractJoinPlanNode cast_node = (AbstractJoinPlanNode) node;
exps.add(cast_node.getPredicate());
break;
}
default:
// Do nothing...
} // SWITCH
for (AbstractExpression exp : exps) {
if (exp == null)
continue;
found.addAll(ExpressionUtil.getExpressionTypes(exp));
} // FOR
return;
}
}.traverse(root);
return (found);
}
示例3: isOrderByNodeRequired
import org.voltdb.plannodes.AbstractJoinPlanNode; //导入依赖的package包/类
/**
* Determine if an OrderByPlanNode is needed. This may return false if the
* statement has no ORDER BY clause, or if the subtree is already producing
* rows in the correct order.
* @param parsedStmt The statement whose plan may need an OrderByPlanNode
* @param root The subtree which may need its output tuples ordered
* @return true if the plan needs an OrderByPlanNode, false otherwise
*/
private static boolean isOrderByNodeRequired(AbstractParsedStmt parsedStmt, AbstractPlanNode root) {
// Only sort when the statement has an ORDER BY.
if ( ! parsedStmt.hasOrderByColumns()) {
return false;
}
SortDirectionType sortDirection = SortDirectionType.INVALID;
// Skip the explicit ORDER BY plan step if an IndexScan is already providing the equivalent ordering.
// Note that even tree index scans that produce values in their own "key order" only report
// their sort direction != SortDirectionType.INVALID
// when they enforce an ordering equivalent to the one requested in the ORDER BY clause.
// Even an intervening non-hash aggregate will not interfere in this optimization.
AbstractPlanNode nonAggPlan = root;
// EE keeps the insertion ORDER so that ORDER BY could apply before DISTINCT.
// However, this probably is not optimal if there are low cardinality results.
// Again, we have to replace the TVEs for ORDER BY clause for these cases in planning.
if (nonAggPlan.getPlanNodeType() == PlanNodeType.AGGREGATE) {
nonAggPlan = nonAggPlan.getChild(0);
}
if (nonAggPlan instanceof IndexScanPlanNode) {
sortDirection = ((IndexScanPlanNode)nonAggPlan).getSortDirection();
}
// Optimization for NestLoopIndex on IN list, possibly other cases of ordered join results.
// Skip the explicit ORDER BY plan step if NestLoopIndex is providing the equivalent ordering
else if (nonAggPlan instanceof AbstractJoinPlanNode) {
sortDirection = ((AbstractJoinPlanNode)nonAggPlan).getSortDirection();
}
if (sortDirection != SortDirectionType.INVALID) {
return false;
}
return true;
}
示例4: needHashAggregator
import org.voltdb.plannodes.AbstractJoinPlanNode; //导入依赖的package包/类
public boolean needHashAggregator(AbstractPlanNode root) {
// A hash is required to build up per-group aggregates in parallel vs.
// when there is only one aggregation over the entire table OR when the
// per-group aggregates are being built serially from the ordered output
// of an index scan.
// Currently, an index scan only claims to have a sort direction when its output
// matches the order demanded by the ORDER BY clause.
if (! m_parsedSelect.isGrouped()) {
return false;
}
if (isChangedToSerialAggregate() && ! m_multiPartition) {
return false;
}
boolean predeterminedOrdering = false;
if (root instanceof IndexScanPlanNode) {
if (((IndexScanPlanNode)root).getSortDirection() != SortDirectionType.INVALID) {
predeterminedOrdering = true;
}
}
else if (root instanceof AbstractJoinPlanNode) {
if (((AbstractJoinPlanNode)root).getSortDirection() != SortDirectionType.INVALID) {
predeterminedOrdering = true;
}
}
if (predeterminedOrdering) {
// The ordering predetermined by indexed access is known to cover (at least) the
// ORDER BY columns.
// Yet, any additional non-ORDER-BY columns in the GROUP BY clause will need
// partial aggregate.
if (m_parsedSelect.groupByIsAnOrderByPermutation()) {
return false;
}
}
return true;
}
示例5: testFunctionJoinConditions
import org.voltdb.plannodes.AbstractJoinPlanNode; //导入依赖的package包/类
public void testFunctionJoinConditions() {
AbstractPlanNode pn = compile("select * FROM R1 JOIN R2 ON ABS(R1.A) = ABS(R2.A) ");
AbstractPlanNode n = pn.getChild(0).getChild(0);
assertTrue(n instanceof AbstractJoinPlanNode);
AbstractExpression p = ((AbstractJoinPlanNode) n).getJoinPredicate();
assertEquals(ExpressionType.COMPARE_EQUAL, p.getExpressionType());
assertEquals(ExpressionType.FUNCTION, p.getLeft().getExpressionType());
assertEquals(ExpressionType.FUNCTION, p.getRight().getExpressionType());
pn = compile("select * FROM R1 ,R2 WHERE ABS(R1.A) = ABS(R2.A) ");
n = pn.getChild(0).getChild(0);
assertTrue(n instanceof AbstractJoinPlanNode);
p = ((AbstractJoinPlanNode) n).getJoinPredicate();
assertEquals(ExpressionType.COMPARE_EQUAL, p.getExpressionType());
assertEquals(ExpressionType.FUNCTION, p.getLeft().getExpressionType());
assertEquals(ExpressionType.FUNCTION, p.getRight().getExpressionType());
pn = compile("select * FROM R1 ,R2");
n = pn.getChild(0).getChild(0);
assertTrue(n instanceof AbstractJoinPlanNode);
p = ((AbstractJoinPlanNode) n).getJoinPredicate();
assertNull(p);
// USING expression can have only comma separated list of column names
failToCompile("select * FROM R1 JOIN R2 USING (ABS(A))",
"user lacks privilege or object not found: ABS");
}
示例6: populateJoinTableInfo
import org.voltdb.plannodes.AbstractJoinPlanNode; //导入依赖的package包/类
/**
* Populate the mappings between AbstractPlanNodes and the tableNames, and
* the element id(?) to set of columns
* @param state
* @param rootNode
*/
public static void populateJoinTableInfo(final PlanOptimizerState state, final AbstractPlanNode rootNode) {
final Set<String> join_tbls = new HashSet<String>();
// Traverse from the bottom up and figure out what tables are referenced
// in each AbstractJoinPlanNode
for (AbstractPlanNode leaf : PlanNodeUtil.getLeafPlanNodes(rootNode)) {
new PlanNodeTreeWalker(false, true) {
@Override
protected void callback(AbstractPlanNode element) {
// ---------------------------------------------------
// AbstractScanPlanNode
// ---------------------------------------------------
if (element instanceof AbstractScanPlanNode) {
join_tbls.add(((AbstractScanPlanNode) element).getTargetTableName());
}
// ---------------------------------------------------
// AbstractJoinPlanNode
// ---------------------------------------------------
else if (element instanceof AbstractJoinPlanNode) {
if (debug.val)
LOG.debug("Updating the list of tables joined at " + element);
// We don't NestLoopPlanNode for now
assert ((element instanceof NestLoopPlanNode) == false);
// Get target table of inline scan
Collection<AbstractScanPlanNode> inline_nodes = element.getInlinePlanNodes(AbstractScanPlanNode.class);
assert (inline_nodes.isEmpty() == false);
AbstractScanPlanNode inline_scan_node = CollectionUtil.first(inline_nodes);
assert (inline_scan_node != null);
join_tbls.add(inline_scan_node.getTargetTableName());
// Add all of the tables that we've seen at this point
// in the tree
state.join_tbl_mapping.put(element, new HashSet<String>(join_tbls));
// Add to join index map which depth is the index
state.join_node_index.put(this.getDepth(), (AbstractJoinPlanNode) element);
Map<String, Integer> single_join_node_output = new HashMap<String, Integer>();
for (int i = 0; i < element.getOutputColumnGUIDCount(); i++) {
int guid = element.getOutputColumnGUID(i);
PlanColumn pc = state.plannerContext.get(guid);
single_join_node_output.put(pc.getDisplayName(), i);
} // FOR
state.join_outputs.put((AbstractJoinPlanNode) element, single_join_node_output);
}
}
}.traverse(leaf);
} // FOR
}
示例7: handleMVBasedMultiPartQuery
import org.voltdb.plannodes.AbstractJoinPlanNode; //导入依赖的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;
}