MCPcopy Create free account
hub / github.com/alibaba/GraphScope / is_compatible

Method is_compatible

python/graphscope/analytical/app/java_app.py:217–281  ·  view source on GitHub ↗
(self, graph)

Source from the content-addressed store, hash-verified

215
216 # Override is_compatible to make sure type params of graph consists with java app.
217 def is_compatible(self, graph):
218 # The GraphTemplate can be vineyard::ArrowFragment<OID_T,VID_T, VERTEX_MAP_T, COMPACT>
219 # or gs::ArrowProjectedFragment<OID_T,VID_T,VDATA_T,EDATA_T, VERTEX_MAP_T, COMPACT>
220 java_app_type_params = self.frag_param_str.split(",")
221 if graph.template_str.find("vineyard::ArrowFragment") != -1:
222 if self.java_app_type.find("property") == -1:
223 logger.error("Expected property app")
224 return False
225 if len(java_app_type_params) != 1:
226 logger.error("Expected one type params.")
227 return False
228 # Get the OID_T from the graph template string
229 split_parts = graph.template_str.split("<")
230 if len(split_parts) > 1:
231 type_parts = split_parts[1].split(",")
232 if len(type_parts) > 0:
233 oid_t = type_parts[0].strip()
234 else:
235 raise Exception(
236 "Error format graph template str: {}".format(graph.template_str)
237 )
238 else:
239 raise Exception(
240 "Error format graph template str: {}".format(graph.template_str)
241 )
242 if not _type_param_consistent(oid_t, java_app_type_params[0]):
243 return False
244 return True
245 elif graph.template_str.find("gs::ArrowProjectedFragment") != -1:
246 if self.java_app_type.find("simple") == -1:
247 logger.error("Expected simple app")
248 return False
249 if len(java_app_type_params) != 4:
250 logger.error("Expected 4 type params")
251 return False
252 split_parts = graph.template_str.split("<")
253 if len(split_parts) > 1:
254 type_parts = split_parts[1].split(",")
255 cpp_graph_type = []
256 if (
257 len(type_parts) > 3
258 ): # Check if there are at least 4 parts to extract
259 cpp_graph_type = type_parts[:4]
260 logger.info("found type param {}".format(cpp_graph_type))
261 else:
262 raise Exception(
263 "Error format graph template str: {}".format(graph.template_str)
264 )
265 for i in range(0, 4):
266 logger.info(
267 "checking type param {},{},{}".format(
268 i, cpp_graph_type[i], java_app_type_params[i]
269 )
270 )
271 if not _type_param_consistent(
272 cpp_graph_type[i], java_app_type_params[i]
273 ):
274 return False

Callers 1

__init__Method · 0.45

Calls 6

splitMethod · 0.80
findMethod · 0.80
_type_param_consistentFunction · 0.70
errorMethod · 0.65
formatMethod · 0.45
infoMethod · 0.45

Tested by

no test coverage detected