When trying to isolate a subgraph via MATCH and an OPTIONAL MATCH clauses, we ran into an issue where if the OPTIONAL MATCH returns a null result, the conversion of the query result to NetworkX fails. Supporting this use case makes sense, as sometimes the query results can contain null values which should be ignored by the get_as_networkx() converter.
Because the query's OPTIONAL MATCH clause asks for a non-existent relationship, we will receive null values in the query result, which throws the following error:
Traceback (most recent call last):
File "/Users/prrao/code/kuzu/test.py", line 31, in <module>
G = result.get_as_networkx()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/prrao/code/kuzu/tools/python_api/build/kuzu/query_result.py", line 283, in get_as_networkx
_id = row[i]["_id"]
~~~~~~^^^^^^^
TypeError: 'NoneType' object is not subscriptable
Kùzu version
No response
What operating system are you using?
No response
What happened?
Based on the additional issue reported in #3640.
When trying to isolate a subgraph via
MATCH
and anOPTIONAL MATCH
clauses, we ran into an issue where if theOPTIONAL MATCH
returns a null result, the conversion of the query result to NetworkX fails. Supporting this use case makes sense, as sometimes the query results can contain null values which should be ignored by theget_as_networkx()
converter.Are there known steps to reproduce?
Run the following code:
Because the query's
OPTIONAL MATCH
clause asks for a non-existent relationship, we will receive null values in the query result, which throws the following error: