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;
}
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);
}
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);
}
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));
}
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);
}
}
Aggregations