Search in sources :

Example 26 with VertexIdManager

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);
}
Also used : ProcessorFunction(com.alibaba.maxgraph.compiler.logical.function.ProcessorFunction) VertexIdManager(com.alibaba.maxgraph.compiler.logical.VertexIdManager)

Example 27 with VertexIdManager

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;
}
Also used : ProcessorFunction(com.alibaba.maxgraph.compiler.logical.function.ProcessorFunction) LogicalVertex(com.alibaba.maxgraph.compiler.logical.LogicalVertex) VertexIdManager(com.alibaba.maxgraph.compiler.logical.VertexIdManager) LogicalSubQueryPlan(com.alibaba.maxgraph.compiler.logical.LogicalSubQueryPlan)

Example 28 with VertexIdManager

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);
}
Also used : ProcessorFunction(com.alibaba.maxgraph.compiler.logical.function.ProcessorFunction) VertexIdManager(com.alibaba.maxgraph.compiler.logical.VertexIdManager)

Example 29 with VertexIdManager

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);
}
Also used : ProcessorFunction(com.alibaba.maxgraph.compiler.logical.function.ProcessorFunction) VertexIdManager(com.alibaba.maxgraph.compiler.logical.VertexIdManager)

Example 30 with VertexIdManager

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;
}
Also used : 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) VertexIdManager(com.alibaba.maxgraph.compiler.logical.VertexIdManager) LogicalSubQueryPlan(com.alibaba.maxgraph.compiler.logical.LogicalSubQueryPlan)

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