Skip to content

Commit c332f70

Browse files
authored
feat(interactive): Support compiler fetching schema from /v1/graph/{graph_id} (#4585)
Previously, compiler get the schema info from the response of `GET /v1/service/status` where the schema info is in the field `graph` of response. However, we should support let compier get schema from the specific graph `GET /v1/graph/{graph_id]/schema`.
1 parent 1fc617f commit c332f70

File tree

1 file changed

+12
-4
lines changed
  • interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/reader

1 file changed

+12
-4
lines changed

interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/reader/HttpIrMetaReader.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,18 @@ private Pair<GraphId, String> convertMetaFromJsonToYaml(String metaInJson) throw
144144
ObjectMapper mapper = new ObjectMapper();
145145
JsonNode rootNode = mapper.readTree(metaInJson);
146146
Map<String, Object> rootMap = mapper.convertValue(rootNode, Map.class);
147-
Map metaMap = (Map) rootMap.get("graph");
148-
GraphId graphId = new GraphId(metaMap.get("id"));
149-
Yaml yaml = new Yaml();
150-
return Pair.with(graphId, yaml.dump(metaMap));
147+
if (rootMap.containsKey("graph")) {
148+
// Parse the response if in the 'graph' field of the response
149+
Map metaMap = (Map) rootMap.get("graph");
150+
GraphId graphId = new GraphId(metaMap.get("id"));
151+
Yaml yaml = new Yaml();
152+
return Pair.with(graphId, yaml.dump(metaMap));
153+
} else {
154+
// Parser the response if the response is the root
155+
GraphId graphId = new GraphId(rootMap.get("id"));
156+
Yaml yaml = new Yaml();
157+
return Pair.with(graphId, yaml.dump(rootMap));
158+
}
151159
}
152160

153161
private boolean getStaticEnabled(String metaInJson) throws IOException {

0 commit comments

Comments
 (0)