use of com.alibaba.maxgraph.compiler.logical.VertexIdManager in project GraphScope by alibaba.
the class SampleGlobalTreeNode method buildLogicalQueryPlan.
@Override
public LogicalSubQueryPlan buildLogicalQueryPlan(ContextManager contextManager) {
TreeNodeLabelManager labelManager = contextManager.getTreeNodeLabelManager();
VertexIdManager vertexIdManager = contextManager.getVertexIdManager();
Message.Value.Builder argumentBuilder = createArgumentBuilder();
argumentBuilder.setIntValue(amountToSample);
ProcessorFunction processorFunction = new ProcessorFunction(QueryFlowOuterClass.OperatorType.SAMPLE, argumentBuilder);
return parseSingleUnaryVertex(vertexIdManager, labelManager, processorFunction, contextManager);
}
use of com.alibaba.maxgraph.compiler.logical.VertexIdManager in project GraphScope by alibaba.
the class SelectOneTreeNode method buildLogicalQueryPlan.
@Override
public LogicalSubQueryPlan buildLogicalQueryPlan(ContextManager contextManager) {
TreeNodeLabelManager labelManager = contextManager.getTreeNodeLabelManager();
VertexIdManager vertexIdManager = contextManager.getVertexIdManager();
Map<String, Integer> labelIndexList = labelManager.getLabelIndexList();
ProcessorFunction selectOneFunction = TreeNodeUtils.createSelectOneFunction(selectLabel, pop, labelIndexList);
LogicalSubQueryPlan logicalSubQueryPlan = parseSingleUnaryVertex(vertexIdManager, labelManager, selectOneFunction, contextManager, LogicalEdge.shuffleByKey(0), null == traversalTreeNode);
if (null != traversalTreeNode && !contextManager.getCostModelManager().processFieldValue(selectLabel)) {
LogicalSubQueryPlan traversalValuePlan = TreeNodeUtils.buildSubQueryPlan(traversalTreeNode, logicalSubQueryPlan.getOutputVertex(), contextManager);
logicalSubQueryPlan.mergeLogicalQueryPlan(traversalValuePlan);
LogicalVertex outputVertex = logicalSubQueryPlan.getOutputVertex();
addUsedLabelAndRequirement(outputVertex, labelManager);
setFinishVertex(outputVertex, labelManager);
}
return logicalSubQueryPlan;
}
use of com.alibaba.maxgraph.compiler.logical.VertexIdManager in project GraphScope by alibaba.
the class ShortestPathTreeNode method buildLogicalQueryPlan.
@Override
public LogicalSubQueryPlan buildLogicalQueryPlan(ContextManager contextManager) {
TreeNodeLabelManager labelManager = contextManager.getTreeNodeLabelManager();
VertexIdManager vertexIdManager = contextManager.getVertexIdManager();
ProcessorFunction processorFunction = new ProcessorFunction(QueryFlowOuterClass.OperatorType.PROGRAM_GRAPH_SHORTESTPATH, createOperatorArgument());
return parseSingleUnaryVertex(vertexIdManager, labelManager, processorFunction, contextManager);
}
use of com.alibaba.maxgraph.compiler.logical.VertexIdManager in project GraphScope by alibaba.
the class ShortestPathVertexProgramTreeNode method buildLogicalQueryPlan.
@Override
public LogicalSubQueryPlan buildLogicalQueryPlan(ContextManager contextManager) {
TreeNodeLabelManager labelManager = contextManager.getTreeNodeLabelManager();
VertexIdManager vertexIdManager = contextManager.getVertexIdManager();
ProcessorFunction processorFunction = new ProcessorFunction(QueryFlowOuterClass.OperatorType.PROGRAM_GRAPH_SHORTESTPATH, createOperatorArgument());
return parseSingleUnaryVertex(vertexIdManager, labelManager, processorFunction, contextManager);
}
use of com.alibaba.maxgraph.compiler.logical.VertexIdManager in project GraphScope by alibaba.
the class StoreTreeNode method buildLogicalQueryPlan.
@Override
public LogicalSubQueryPlan buildLogicalQueryPlan(ContextManager contextManager) {
TreeNodeLabelManager treeNodeLabelManager = contextManager.getTreeNodeLabelManager();
VertexIdManager vertexIdManager = contextManager.getVertexIdManager();
LogicalVertex storeVertex;
LogicalSubQueryPlan logicalSubQueryPlan;
if (null == storeTreeNode) {
ProcessorFunction processorFunction = new ProcessorFunction(QueryFlowOuterClass.OperatorType.FOLD_STORE);
logicalSubQueryPlan = parseSingleUnaryVertex(vertexIdManager, treeNodeLabelManager, processorFunction, contextManager);
storeVertex = logicalSubQueryPlan.getOutputVertex();
} else {
logicalSubQueryPlan = new LogicalSubQueryPlan(contextManager);
LogicalVertex sourceVertex = getInputNode().getOutputVertex();
logicalSubQueryPlan.addLogicalVertex(sourceVertex);
LogicalSubQueryPlan storeQueryPlan = TreeNodeUtils.buildQueryPlanWithSource(storeTreeNode, treeNodeLabelManager, contextManager, vertexIdManager, sourceVertex);
logicalSubQueryPlan.mergeLogicalQueryPlan(storeQueryPlan);
LogicalVertex valueVertex = logicalSubQueryPlan.getOutputVertex();
ProcessorFunction processorFunction = new ProcessorFunction(QueryFlowOuterClass.OperatorType.FOLD_STORE);
LogicalVertex foldVertex = new LogicalUnaryVertex(vertexIdManager.getId(), processorFunction, false, valueVertex);
logicalSubQueryPlan.addLogicalVertex(foldVertex);
logicalSubQueryPlan.addLogicalEdge(valueVertex, foldVertex, new LogicalEdge(EdgeShuffleType.SHUFFLE_BY_CONST));
storeVertex = logicalSubQueryPlan.getOutputVertex();
}
storeVertex.enableStoreFlag();
setFinishVertex(getInputNode().getOutputVertex(), treeNodeLabelManager);
contextManager.addStoreVertex(sideEffectKey, storeVertex);
return logicalSubQueryPlan;
}
Aggregations