use of com.alibaba.graphscope.proto.write.DataRecordPb in project GraphScope by alibaba.
the class WriteRequest method parseProto.
public static WriteRequest parseProto(WriteRequestPb proto) {
WriteTypePb writeTypePb = proto.getWriteType();
DataRecordPb dataRecordPb = proto.getDataRecord();
Map<String, Object> properties = Collections.unmodifiableMap(dataRecordPb.getPropertiesMap());
DataRecordPb.RecordKeyCase recordKeyCase = dataRecordPb.getRecordKeyCase();
switch(recordKeyCase) {
case VERTEX_RECORD_KEY:
VertexRecordKey vertexRecordKey = VertexRecordKey.parseProto(dataRecordPb.getVertexRecordKey());
return buildWriteVertexRequest(writeTypePb, new DataRecord(vertexRecordKey, properties));
case EDGE_RECORD_KEY:
EdgeRecordKey edgeRecordKey = EdgeRecordKey.parseProto(dataRecordPb.getEdgeRecordKey());
return buildWriteEdgeRequest(writeTypePb, new DataRecord(edgeRecordKey, properties));
default:
throw new IllegalArgumentException("Invalid record key case [" + recordKeyCase + "]");
}
}
Aggregations