Search in sources :

Example 31 with VertexIdManager

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

the class TokenTreeNode method buildLogicalQueryPlan.

@Override
public LogicalSubQueryPlan buildLogicalQueryPlan(ContextManager contextManager) {
    TreeNodeLabelManager labelManager = contextManager.getTreeNodeLabelManager();
    VertexIdManager vertexIdManager = contextManager.getVertexIdManager();
    Message.Value.Builder argumentBuilder = Message.Value.newBuilder();
    switch(token) {
        case id:
            {
                argumentBuilder.addIntValueList(TreeConstants.ID_INDEX);
                break;
            }
        case label:
            {
                argumentBuilder.addIntValueList(TreeConstants.LABEL_INDEX);
                break;
            }
        case key:
            {
                argumentBuilder.addIntValueList(TreeConstants.KEY_INDEX);
                break;
            }
        case value:
            {
                argumentBuilder.addIntValueList(TreeConstants.VALUE_INDEX);
                break;
            }
    }
    ProcessorFunction processorFunction = new ProcessorFunction(QueryFlowOuterClass.OperatorType.PROP_VALUE, argumentBuilder);
    return parseSingleUnaryVertex(vertexIdManager, labelManager, processorFunction, contextManager);
}
Also used : ProcessorFunction(com.alibaba.maxgraph.compiler.logical.function.ProcessorFunction) VertexIdManager(com.alibaba.maxgraph.compiler.logical.VertexIdManager)

Example 32 with VertexIdManager

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

the class TraversalMapTreeNode method buildLogicalQueryPlan.

@Override
public LogicalSubQueryPlan buildLogicalQueryPlan(ContextManager contextManager) {
    TreeNodeLabelManager labelManager = contextManager.getTreeNodeLabelManager();
    VertexIdManager vertexIdManager = contextManager.getVertexIdManager();
    LogicalSubQueryPlan logicalSubQueryPlan = new LogicalSubQueryPlan(contextManager);
    LogicalVertex delegateSourceVertex = getInputNode().getOutputVertex();
    logicalSubQueryPlan.addLogicalVertex(delegateSourceVertex);
    TreeNode currTraversalNode = TreeNodeUtils.buildSingleOutputNode(traversalNode, schema);
    LogicalSubQueryPlan traversalPlan = TreeNodeUtils.buildQueryPlanWithSource(currTraversalNode, labelManager, contextManager, vertexIdManager, delegateSourceVertex);
    logicalSubQueryPlan.mergeLogicalQueryPlan(traversalPlan);
    LogicalVertex outputVertex = logicalSubQueryPlan.getOutputVertex();
    addUsedLabelAndRequirement(outputVertex, labelManager);
    setFinishVertex(outputVertex, labelManager);
    return logicalSubQueryPlan;
}
Also used : LogicalVertex(com.alibaba.maxgraph.compiler.logical.LogicalVertex) VertexIdManager(com.alibaba.maxgraph.compiler.logical.VertexIdManager) LogicalSubQueryPlan(com.alibaba.maxgraph.compiler.logical.LogicalSubQueryPlan)

Example 33 with VertexIdManager

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

the class OrderLocalTreeNode method buildLogicalQueryPlan.

@Override
public LogicalSubQueryPlan buildLogicalQueryPlan(ContextManager contextManager) {
    TreeNodeLabelManager labelManager = contextManager.getTreeNodeLabelManager();
    VertexIdManager vertexIdManager = contextManager.getVertexIdManager();
    Message.OrderComparatorList.Builder comparatorList = Message.OrderComparatorList.newBuilder();
    orderTreeNodeList.forEach(v -> {
        comparatorList.addOrderComparator(Message.OrderComparator.newBuilder().setPropId(getPropLabelId(v.getLeft(), labelManager.getLabelIndexList())).setOrderType(Message.OrderType.valueOf(StringUtils.upperCase(v.getRight().name()))));
    });
    ProcessorFunction processorFunction = new ProcessorFunction(QueryFlowOuterClass.OperatorType.ORDER_LOCAL, Message.Value.newBuilder().setPayload(comparatorList.build().toByteString()));
    return parseSingleUnaryVertex(vertexIdManager, labelManager, processorFunction, contextManager);
}
Also used : ProcessorFunction(com.alibaba.maxgraph.compiler.logical.function.ProcessorFunction) VertexIdManager(com.alibaba.maxgraph.compiler.logical.VertexIdManager)

Example 34 with VertexIdManager

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

the class PageRankTreeNode method buildLogicalQueryPlan.

@Override
public LogicalSubQueryPlan buildLogicalQueryPlan(ContextManager contextManager) {
    TreeNodeLabelManager labelManager = contextManager.getTreeNodeLabelManager();
    VertexIdManager vertexIdManager = contextManager.getVertexIdManager();
    ProcessorFunction processorFunction = new ProcessorFunction(OperatorType.PROGRAM_GRAPH_PAGERANK, 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 35 with VertexIdManager

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

the class PageRankVertexProgramTreeNode method buildLogicalQueryPlan.

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

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