use of com.alibaba.maxgraph.QueryFlowOuterClass.OdpsOutputConfig.Builder 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.QueryFlowOuterClass.OdpsOutputConfig.Builder in project GraphScope by alibaba.
the class OutputTreeNode method buildArg.
private Builder buildArg() {
if (this.path.startsWith(TUNNEL)) {
String remain = StringUtils.removeStart(path, TUNNEL);
String[] tokens = StringUtils.split(remain, '@');
if (tokens.length != 2) {
throw ILLEGAL_TUNNEL_EXCEPTION;
}
String[] idKey = StringUtils.split(tokens[0], ':');
if (idKey.length != 2) {
throw ILLEGAL_TUNNEL_EXCEPTION;
}
Builder odpsConfigBuilder = QueryFlowOuterClass.OdpsOutputConfig.newBuilder().setAccessId(idKey[0]).setAccessKey(idKey[1]);
String[] endpointAndOthers = StringUtils.split(tokens[1], '#');
if (endpointAndOthers.length != 2) {
throw ILLEGAL_TUNNEL_EXCEPTION;
}
odpsConfigBuilder.setEndpoint(endpointAndOthers[0]);
String[] details = StringUtils.split(endpointAndOthers[1], '&');
for (String detail : details) {
String[] keyValue = StringUtils.split(detail, '=');
if (keyValue.length != 2) {
throw ILLEGAL_TUNNEL_EXCEPTION;
}
if (keyValue[0].equalsIgnoreCase("project")) {
odpsConfigBuilder.setProject(keyValue[1]);
} else if (keyValue[0].equalsIgnoreCase("table")) {
odpsConfigBuilder.setTableName(keyValue[1]);
} else if (keyValue[0].equalsIgnoreCase("ds")) {
odpsConfigBuilder.setDs(keyValue[1]);
} else {
throw ILLEGAL_TUNNEL_EXCEPTION;
}
}
return odpsConfigBuilder;
}
throw ILLEGAL_TUNNEL_EXCEPTION;
}
Aggregations