Search in sources :

Example 36 with VertexIdManager

use of com.alibaba.maxgraph.compiler.logical.VertexIdManager in project GraphScope by alibaba.

the class PathTreeNode method buildLogicalQueryPlan.

@Override
public LogicalSubQueryPlan buildLogicalQueryPlan(ContextManager contextManager) {
    TreeNodeLabelManager labelManager = contextManager.getTreeNodeLabelManager();
    VertexIdManager vertexIdManager = contextManager.getVertexIdManager();
    Message.Value.Builder argumentBuilder = Message.Value.newBuilder().addAllPathOutValue(getPathOutValueList(labelManager.getLabelIndexList())).setBoolValue(pathDeleteFlag);
    ProcessorFunction processorFunction = new ProcessorFunction(QueryFlowOuterClass.OperatorType.PATH_OUT, argumentBuilder);
    return parseSingleUnaryVertex(vertexIdManager, labelManager, processorFunction, contextManager, new LogicalEdge(EdgeShuffleType.FORWARD));
}
Also used : ProcessorFunction(com.alibaba.maxgraph.compiler.logical.function.ProcessorFunction) LogicalEdge(com.alibaba.maxgraph.compiler.logical.LogicalEdge) VertexIdManager(com.alibaba.maxgraph.compiler.logical.VertexIdManager)

Example 37 with VertexIdManager

use of com.alibaba.maxgraph.compiler.logical.VertexIdManager in project GraphScope by alibaba.

the class HitsVertexProgramTreeNode method buildLogicalQueryPlan.

@Override
public LogicalSubQueryPlan buildLogicalQueryPlan(ContextManager contextManager) {
    TreeNodeLabelManager labelManager = contextManager.getTreeNodeLabelManager();
    VertexIdManager vertexIdManager = contextManager.getVertexIdManager();
    ProcessorFunction processorFunction = new ProcessorFunction(QueryFlowOuterClass.OperatorType.PROGRAM_GRAPH_HITS, createOperatorArgument());
    return parseSingleUnaryVertex(vertexIdManager, labelManager, processorFunction, contextManager);
}
Also used : ProcessorFunction(com.alibaba.maxgraph.compiler.logical.function.ProcessorFunction) VertexIdManager(com.alibaba.maxgraph.compiler.logical.VertexIdManager)

Example 38 with VertexIdManager

use of com.alibaba.maxgraph.compiler.logical.VertexIdManager in project GraphScope by alibaba.

the class UnfoldTreeNode method buildLogicalQueryPlan.

@Override
public LogicalSubQueryPlan buildLogicalQueryPlan(ContextManager contextManager) {
    TreeNodeLabelManager labelManager = contextManager.getTreeNodeLabelManager();
    VertexIdManager vertexIdManager = contextManager.getVertexIdManager();
    ProcessorFunction processorFunction = new ProcessorFunction(QueryFlowOuterClass.OperatorType.UNFOLD, rangeLimit);
    return parseSingleUnaryVertex(vertexIdManager, labelManager, processorFunction, contextManager);
}
Also used : ProcessorFunction(com.alibaba.maxgraph.compiler.logical.function.ProcessorFunction) VertexIdManager(com.alibaba.maxgraph.compiler.logical.VertexIdManager)

Example 39 with VertexIdManager

use of com.alibaba.maxgraph.compiler.logical.VertexIdManager in project GraphScope by alibaba.

the class TreeNodeUtils method buildSubQueryPlan.

/**
 * Build sub query plan from given leaf tree node
 *
 * @param treeNode The given leaf tree node
 * @param sourceVertex The source vertex
 * @param contextManager The context manager
 * @param generateUseKey The flag of generated use key, it may be generated outside such as
 *     group
 * @return The query plan of sub query
 */
public static LogicalSubQueryPlan buildSubQueryPlan(TreeNode treeNode, LogicalVertex sourceVertex, ContextManager contextManager, boolean generateUseKey) {
    TreeNodeLabelManager treeNodeLabelManager = contextManager.getTreeNodeLabelManager();
    VertexIdManager vertexIdManager = contextManager.getVertexIdManager();
    List<TreeNode> treeNodeList = buildTreeNodeListFromLeaf(treeNode);
    boolean useKeyFlag = checkNodeListUseKey(treeNodeList);
    LogicalSubQueryPlan logicalSubQueryPlan = new LogicalSubQueryPlan(contextManager);
    LogicalVertex currentSourceVertex = sourceVertex;
    for (TreeNode currentNode : treeNodeList) {
        if (currentNode instanceof AbstractUseKeyNode) {
            ((AbstractUseKeyNode) currentNode).enableUseKeyFlag(currentSourceVertex);
        }
        if (currentNode instanceof SourceDelegateNode) {
            if (useKeyFlag && generateUseKey) {
                LogicalVertex enterKeyVertex = new LogicalUnaryVertex(vertexIdManager.getId(), new ProcessorFunction(QueryFlowOuterClass.OperatorType.ENTER_KEY, Message.Value.newBuilder().setPayload(QueryFlowOuterClass.EnterKeyArgumentProto.newBuilder().setEnterKeyType(QueryFlowOuterClass.EnterKeyTypeProto.KEY_SELF).setUniqFlag(true).build().toByteString())), false, currentSourceVertex);
                currentNode.setFinishVertex(enterKeyVertex, treeNodeLabelManager);
                logicalSubQueryPlan.addLogicalVertex(currentSourceVertex);
                logicalSubQueryPlan.addLogicalVertex(enterKeyVertex);
                logicalSubQueryPlan.addLogicalEdge(currentSourceVertex, enterKeyVertex, new LogicalEdge());
                currentSourceVertex = enterKeyVertex;
            } else {
                currentNode.setFinishVertex(currentSourceVertex, treeNodeLabelManager);
                logicalSubQueryPlan.addLogicalVertex(currentSourceVertex);
            }
        }
        logicalSubQueryPlan.mergeLogicalQueryPlan(currentNode.buildLogicalQueryPlan(contextManager));
    }
    return logicalSubQueryPlan;
}
Also used : TreeNodeLabelManager(com.alibaba.maxgraph.compiler.tree.TreeNodeLabelManager) LogicalUnaryVertex(com.alibaba.maxgraph.compiler.logical.LogicalUnaryVertex) LogicalVertex(com.alibaba.maxgraph.compiler.logical.LogicalVertex) ProcessorFunction(com.alibaba.maxgraph.compiler.logical.function.ProcessorFunction) LogicalEdge(com.alibaba.maxgraph.compiler.logical.LogicalEdge) SourceTreeNode(com.alibaba.maxgraph.compiler.tree.source.SourceTreeNode) VertexTreeNode(com.alibaba.maxgraph.compiler.tree.VertexTreeNode) MaxTreeNode(com.alibaba.maxgraph.compiler.tree.MaxTreeNode) RangeGlobalTreeNode(com.alibaba.maxgraph.compiler.tree.RangeGlobalTreeNode) FoldTreeNode(com.alibaba.maxgraph.compiler.tree.FoldTreeNode) TreeNode(com.alibaba.maxgraph.compiler.tree.TreeNode) TokenTreeNode(com.alibaba.maxgraph.compiler.tree.TokenTreeNode) MinTreeNode(com.alibaba.maxgraph.compiler.tree.MinTreeNode) CountGlobalTreeNode(com.alibaba.maxgraph.compiler.tree.CountGlobalTreeNode) HasTreeNode(com.alibaba.maxgraph.compiler.tree.HasTreeNode) SelectOneTreeNode(com.alibaba.maxgraph.compiler.tree.SelectOneTreeNode) PropertyMapTreeNode(com.alibaba.maxgraph.compiler.tree.PropertyMapTreeNode) SumTreeNode(com.alibaba.maxgraph.compiler.tree.SumTreeNode) UnaryTreeNode(com.alibaba.maxgraph.compiler.tree.UnaryTreeNode) SourceDelegateNode(com.alibaba.maxgraph.compiler.tree.source.SourceDelegateNode) VertexIdManager(com.alibaba.maxgraph.compiler.logical.VertexIdManager) LogicalSubQueryPlan(com.alibaba.maxgraph.compiler.logical.LogicalSubQueryPlan) AbstractUseKeyNode(com.alibaba.maxgraph.compiler.tree.addition.AbstractUseKeyNode)

Aggregations

VertexIdManager (com.alibaba.maxgraph.compiler.logical.VertexIdManager)39 ProcessorFunction (com.alibaba.maxgraph.compiler.logical.function.ProcessorFunction)34 LogicalSubQueryPlan (com.alibaba.maxgraph.compiler.logical.LogicalSubQueryPlan)18 LogicalVertex (com.alibaba.maxgraph.compiler.logical.LogicalVertex)18 LogicalEdge (com.alibaba.maxgraph.compiler.logical.LogicalEdge)17 LogicalUnaryVertex (com.alibaba.maxgraph.compiler.logical.LogicalUnaryVertex)13 QueryFlowOuterClass (com.alibaba.maxgraph.QueryFlowOuterClass)6 LogicalBinaryVertex (com.alibaba.maxgraph.compiler.logical.LogicalBinaryVertex)6 Message (com.alibaba.maxgraph.Message)5 SourceTreeNode (com.alibaba.maxgraph.compiler.tree.source.SourceTreeNode)5 SourceDelegateNode (com.alibaba.maxgraph.compiler.tree.source.SourceDelegateNode)4 TreeNodeLabelManager (com.alibaba.maxgraph.compiler.tree.TreeNodeLabelManager)3 List (java.util.List)3 Pair (org.apache.commons.lang3.tuple.Pair)3 LogicalQueryPlan (com.alibaba.maxgraph.compiler.logical.LogicalQueryPlan)2 LogicalSourceDelegateVertex (com.alibaba.maxgraph.compiler.logical.LogicalSourceDelegateVertex)2 LogicalSourceVertex (com.alibaba.maxgraph.compiler.logical.LogicalSourceVertex)2 EdgeShuffleType (com.alibaba.maxgraph.compiler.logical.edge.EdgeShuffleType)2 ProcessorFilterFunction (com.alibaba.maxgraph.compiler.logical.function.ProcessorFilterFunction)2 ProcessorRepeatFunction (com.alibaba.maxgraph.compiler.logical.function.ProcessorRepeatFunction)2