use of com.alibaba.maxgraph.compiler.tree.source.SourceVertexTreeNode in project GraphScope by alibaba.
the class TreeManager method optimizeOrderRange.
/**
* Optimize order+range operator
*/
private void optimizeOrderRange() {
TreeNode currentTreeNode = treeLeaf;
while (!(currentTreeNode instanceof SourceTreeNode)) {
if (currentTreeNode instanceof OrderGlobalTreeNode) {
OrderGlobalTreeNode orderGlobalTreeNode = OrderGlobalTreeNode.class.cast(currentTreeNode);
TreeNode orderInputNode = orderGlobalTreeNode.getInputNode();
if (orderInputNode instanceof SourceVertexTreeNode && ((SourceVertexTreeNode) orderInputNode).getBeforeRequirementList().isEmpty() && ((SourceVertexTreeNode) orderInputNode).getAfterRequirementList().isEmpty() && orderGlobalTreeNode.isEmptyOrderNode() && !orderGlobalTreeNode.orderFlag && null != orderGlobalTreeNode.rangeLimit) {
QueryFlowOuterClass.RangeLimit.Builder orderRangeBuilder = orderGlobalTreeNode.rangeLimit;
orderInputNode.setRangeLimit(0, orderRangeBuilder.getRangeEnd(), true);
((SourceVertexTreeNode) orderInputNode).enablePartitionIdFlag();
orderGlobalTreeNode.enablePartitionIdFlag();
}
}
currentTreeNode = UnaryTreeNode.class.cast(currentTreeNode).getInputNode();
}
}
use of com.alibaba.maxgraph.compiler.tree.source.SourceVertexTreeNode in project GraphScope by alibaba.
the class TreeBuilder method visitGraphStep.
/**
* Convert graph step to SourceTreeNode
*
* @param step The given GraphStep
*/
private TreeNode visitGraphStep(GraphStep step) {
if (step instanceof MaxGraphStep) {
Map<String, Object> queryConfig = ((MaxGraphStep) step).getQueryConfig();
if (null != queryConfig) {
this.queryConfig.putAll(queryConfig);
}
}
Object[] ids = step.getIds();
SourceTreeNode sourceTreeNode;
if (step.returnsVertex()) {
if (null == ids || ids.length == 0) {
sourceTreeNode = new SourceVertexTreeNode(schema);
} else {
sourceTreeNode = new SourceVertexTreeNode(ids, schema);
}
} else {
if (null == ids || ids.length == 0) {
sourceTreeNode = new SourceEdgeTreeNode(schema);
} else {
sourceTreeNode = new SourceEdgeTreeNode(ids, schema);
}
}
Supplier<?> supplier = step.getTraversal().getSideEffects().getSackInitialValue();
if (null != supplier) {
sourceTreeNode.setInitialSackValue(supplier.get());
}
return sourceTreeNode;
}
Aggregations