Search in sources :

Example 56 with ProcessorFunction

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

the class OutputVineyardTreeNode method buildLogicalQueryPlan.

@Override
public LogicalSubQueryPlan buildLogicalQueryPlan(ContextManager contextManager) {
    TreeNode inputNode = this.getInputNode();
    LogicalVertex inputVertex = inputNode.getOutputVertex();
    LogicalSubQueryPlan logicalSubQueryPlan = new LogicalSubQueryPlan(contextManager);
    logicalSubQueryPlan.addLogicalVertex(inputVertex);
    LogicalVertex vineyardVertex = new LogicalUnaryVertex(contextManager.getVertexIdManager().getId(), new ProcessorFunction(QueryFlowOuterClass.OperatorType.OUTPUT_VINEYARD_VERTEX, Message.Value.newBuilder().setStrValue(this.graphName)), inputVertex);
    logicalSubQueryPlan.addLogicalVertex(vineyardVertex);
    logicalSubQueryPlan.addLogicalEdge(inputVertex, vineyardVertex, LogicalEdge.shuffleByKey(0));
    LogicalVertex vineyardEdge = new LogicalUnaryVertex(contextManager.getVertexIdManager().getId(), new ProcessorFunction(QueryFlowOuterClass.OperatorType.OUTPUT_VINEYARD_EDGE, Message.Value.newBuilder().setStrValue(this.graphName)), inputVertex);
    logicalSubQueryPlan.addLogicalVertex(vineyardEdge);
    logicalSubQueryPlan.addLogicalEdge(vineyardVertex, vineyardEdge, LogicalEdge.forwardEdge());
    LogicalVertex sumVertex = new LogicalUnaryVertex(contextManager.getVertexIdManager().getId(), new ProcessorFunction(QueryFlowOuterClass.OperatorType.SUM, Message.Value.newBuilder().setValueType(Message.VariantType.VT_LONG)), vineyardEdge);
    logicalSubQueryPlan.addLogicalVertex(sumVertex);
    logicalSubQueryPlan.addLogicalEdge(vineyardEdge, sumVertex, LogicalEdge.shuffleConstant());
    setFinishVertex(sumVertex, contextManager.getTreeNodeLabelManager());
    addUsedLabelAndRequirement(sumVertex, contextManager.getTreeNodeLabelManager());
    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) LogicalSubQueryPlan(com.alibaba.maxgraph.compiler.logical.LogicalSubQueryPlan)

Example 57 with ProcessorFunction

use of com.alibaba.maxgraph.compiler.logical.function.ProcessorFunction 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 58 with ProcessorFunction

use of com.alibaba.maxgraph.compiler.logical.function.ProcessorFunction 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)

Example 59 with ProcessorFunction

use of com.alibaba.maxgraph.compiler.logical.function.ProcessorFunction 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 60 with ProcessorFunction

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

the class EdgeTreeNode method buildLogicalQueryPlan.

@Override
public LogicalSubQueryPlan buildLogicalQueryPlan(ContextManager contextManager) {
    Message.Value.Builder argumentBuilder = createArgumentBuilder();
    if (null != edgeLabels) {
        for (String edgeLabel : edgeLabels) {
            argumentBuilder.addIntValueList(schema.getElement(edgeLabel).getLabelId());
        }
    }
    argumentBuilder.setBoolValue(fetchPropFlag);
    if (null != rangeLimit) {
        argumentBuilder.setBoolFlag(globalRangeFlag);
    }
    if (amountToSample > 0 && StringUtils.isNotEmpty(probabilityProperty)) {
        argumentBuilder.setIntValue(SchemaUtils.getPropId(probabilityProperty, schema)).setLongValue(amountToSample);
    }
    ProcessorFunction processorFunction = new ProcessorFunction(isCountFlag() ? QueryFlowOuterClass.OperatorType.valueOf(direction.name() + "_COUNT") : QueryFlowOuterClass.OperatorType.valueOf(direction.name() + "_E"), argumentBuilder, rangeLimit);
    if (direction == Direction.OUT && getInputNode().isPropLocalFlag()) {
        return parseSingleUnaryVertex(contextManager.getVertexIdManager(), contextManager.getTreeNodeLabelManager(), processorFunction, contextManager, new LogicalEdge(EdgeShuffleType.FORWARD));
    } else {
        return parseSingleUnaryVertex(contextManager.getVertexIdManager(), contextManager.getTreeNodeLabelManager(), processorFunction, contextManager);
    }
}
Also used : ProcessorFunction(com.alibaba.maxgraph.compiler.logical.function.ProcessorFunction) LogicalEdge(com.alibaba.maxgraph.compiler.logical.LogicalEdge)

Aggregations

ProcessorFunction (com.alibaba.maxgraph.compiler.logical.function.ProcessorFunction)71 LogicalVertex (com.alibaba.maxgraph.compiler.logical.LogicalVertex)38 LogicalEdge (com.alibaba.maxgraph.compiler.logical.LogicalEdge)36 LogicalSubQueryPlan (com.alibaba.maxgraph.compiler.logical.LogicalSubQueryPlan)34 VertexIdManager (com.alibaba.maxgraph.compiler.logical.VertexIdManager)34 LogicalUnaryVertex (com.alibaba.maxgraph.compiler.logical.LogicalUnaryVertex)27 QueryFlowOuterClass (com.alibaba.maxgraph.QueryFlowOuterClass)18 LogicalBinaryVertex (com.alibaba.maxgraph.compiler.logical.LogicalBinaryVertex)18 SourceDelegateNode (com.alibaba.maxgraph.compiler.tree.source.SourceDelegateNode)10 SourceTreeNode (com.alibaba.maxgraph.compiler.tree.source.SourceTreeNode)9 Message (com.alibaba.maxgraph.Message)7 LogicalQueryPlan (com.alibaba.maxgraph.compiler.logical.LogicalQueryPlan)7 TreeNode (com.alibaba.maxgraph.compiler.tree.TreeNode)5 List (java.util.List)5 ProcessorSourceFunction (com.alibaba.maxgraph.compiler.logical.function.ProcessorSourceFunction)4 CountGlobalTreeNode (com.alibaba.maxgraph.compiler.tree.CountGlobalTreeNode)4 FoldTreeNode (com.alibaba.maxgraph.compiler.tree.FoldTreeNode)4 HasTreeNode (com.alibaba.maxgraph.compiler.tree.HasTreeNode)4 MaxTreeNode (com.alibaba.maxgraph.compiler.tree.MaxTreeNode)4 MinTreeNode (com.alibaba.maxgraph.compiler.tree.MinTreeNode)4