use of com.alibaba.maxgraph.compiler.logical.function.ProcessorFunction in project GraphScope by alibaba.
the class OutputTreeNode method buildLogicalQueryPlan.
@Override
public LogicalSubQueryPlan buildLogicalQueryPlan(ContextManager contextManager) {
TreeNodeLabelManager labelManager = contextManager.getTreeNodeLabelManager();
VertexIdManager vertexIdManager = contextManager.getVertexIdManager();
Builder odpsConfigBuilder = buildArg();
for (String propName : properties) {
odpsConfigBuilder.addPropId(SchemaUtils.getPropId(propName, schema));
}
Message.Value.Builder argumentBuilder = Message.Value.newBuilder().setPayload(odpsConfigBuilder.build().toByteString());
ProcessorFunction processorFunction = new ProcessorFunction(QueryFlowOuterClass.OperatorType.WRITE_ODPS, argumentBuilder);
LogicalSubQueryPlan logicalSubQueryPlan = parseSingleUnaryVertex(vertexIdManager, labelManager, processorFunction, contextManager);
LogicalVertex outputVertex = logicalSubQueryPlan.getOutputVertex();
ProcessorFunction sumFunction = new ProcessorFunction(QueryFlowOuterClass.OperatorType.SUM, Message.Value.newBuilder().setValueType(Message.VariantType.VT_LONG));
LogicalVertex sumVertex = new LogicalUnaryVertex(vertexIdManager.getId(), sumFunction, true, outputVertex);
logicalSubQueryPlan.addLogicalVertex(sumVertex);
logicalSubQueryPlan.addLogicalEdge(outputVertex, sumVertex, new LogicalEdge(EdgeShuffleType.SHUFFLE_BY_CONST));
addUsedLabelAndRequirement(sumVertex, labelManager);
setFinishVertex(sumVertex, labelManager);
return logicalSubQueryPlan;
}
use of com.alibaba.maxgraph.compiler.logical.function.ProcessorFunction in project GraphScope by alibaba.
the class PeerPressureVertexProgramTreeNode method buildLogicalQueryPlan.
@Override
public LogicalSubQueryPlan buildLogicalQueryPlan(ContextManager contextManager) {
TreeNodeLabelManager labelManager = contextManager.getTreeNodeLabelManager();
VertexIdManager vertexIdManager = contextManager.getVertexIdManager();
ProcessorFunction processorFunction = new ProcessorFunction(QueryFlowOuterClass.OperatorType.PROGRAM_GRAPH_PEERPRESSURE, createOperatorArgument());
return parseSingleUnaryVertex(vertexIdManager, labelManager, processorFunction, contextManager);
}
use of com.alibaba.maxgraph.compiler.logical.function.ProcessorFunction in project GraphScope by alibaba.
the class PropFillTreeNode method buildLogicalQueryPlan.
@Override
public LogicalSubQueryPlan buildLogicalQueryPlan(ContextManager contextManager) {
TreeNodeLabelManager labelManager = contextManager.getTreeNodeLabelManager();
VertexIdManager vertexIdManager = contextManager.getVertexIdManager();
Message.Value.Builder argumentBuilder = Message.Value.newBuilder();
propKeyList.forEach(v -> argumentBuilder.addIntValueList(SchemaUtils.getPropId(v, schema)));
ProcessorFunction processorFunction = new ProcessorFunction(QueryFlowOuterClass.OperatorType.PROP_FILL, argumentBuilder);
if (getInputNode() instanceof SourceVertexTreeNode) {
return parseSingleUnaryVertex(vertexIdManager, labelManager, processorFunction, contextManager, new LogicalEdge(EdgeShuffleType.FORWARD));
} else {
return parseSingleUnaryVertex(vertexIdManager, labelManager, processorFunction, contextManager);
}
}
use of com.alibaba.maxgraph.compiler.logical.function.ProcessorFunction in project GraphScope by alibaba.
the class ColumnTreeNode method buildLogicalQueryPlan.
@Override
public LogicalSubQueryPlan buildLogicalQueryPlan(ContextManager contextManager) {
Map<String, Integer> labelIndexList = contextManager.getTreeNodeLabelManager().getLabelIndexList();
List<Integer> labelIdList = Lists.newArrayList();
List<String> labelNameList = Lists.newArrayList();
for (Map.Entry<String, Integer> entry : labelIndexList.entrySet()) {
if (entry.getValue() > TreeConstants.SYS_LABEL_START && entry.getValue() <= TreeConstants.USER_LABEL_START)
labelIdList.add(entry.getValue());
labelNameList.add(entry.getKey());
}
ProcessorFunction processorFunction = new ProcessorFunction(QueryFlowOuterClass.OperatorType.COLUMN, Message.Value.newBuilder().setIntValue(QueryFlowOuterClass.ColumnType.valueOf("COLUMN_" + StringUtils.upperCase(column.name())).getNumber()).addAllIntValueList(labelIdList).addAllStrValueList(labelNameList));
return parseSingleUnaryVertex(contextManager.getVertexIdManager(), contextManager.getTreeNodeLabelManager(), processorFunction, contextManager);
}
use of com.alibaba.maxgraph.compiler.logical.function.ProcessorFunction in project GraphScope by alibaba.
the class ConstantTreeNode method buildLogicalQueryPlan.
@Override
public LogicalSubQueryPlan buildLogicalQueryPlan(ContextManager contextManager) {
Message.Value.Builder argumentBuilder = Message.Value.newBuilder().setValueType(variantType);
switch(variantType) {
case VT_INT:
{
argumentBuilder.setIntValue((int) constant);
break;
}
case VT_LONG:
{
argumentBuilder.setLongValue((long) constant);
break;
}
case VT_FLOAT:
{
argumentBuilder.setFloatValue((float) constant);
break;
}
case VT_DOUBLE:
{
argumentBuilder.setDoubleValue((double) constant);
break;
}
case VT_STRING:
{
argumentBuilder.setStrValue((String) constant);
break;
}
case VT_INT_LIST:
{
argumentBuilder.addAllIntValueList((Collection<Integer>) constant);
break;
}
case VT_LONG_LIST:
{
argumentBuilder.addAllLongValueList((Collection<Long>) constant);
break;
}
case VT_STRING_LIST:
{
argumentBuilder.addAllStrValueList((Collection<String>) constant);
break;
}
default:
{
throw new IllegalArgumentException("Not support " + variantType + " constant value");
}
}
ProcessorFunction processorFunction = new ProcessorFunction(QueryFlowOuterClass.OperatorType.CONSTANT, argumentBuilder);
return parseSingleUnaryVertex(contextManager.getVertexIdManager(), contextManager.getTreeNodeLabelManager(), processorFunction, contextManager);
}
Aggregations