You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I stumbled upon this more by accident than anything. Basically, if we project 0 nodes and 1 relationship, we get the array index out of bounds exception. We could try and catch this error and return a more descriptive error such as "You failed to project any node" or something.
Create graph:
CREATE (a:Node)-[:REL]->(b:Node)
Project graph
CALL gds.graph.create.cypher(
'not_exist',
'MATCH (n:NotExist) RETURN id(n) AS id',
'MATCH (n)-->(m) RETURN id(n) AS source, id(m) AS target'
)
We get the following error:
Failed to invoke procedure gds.graph.create.cypher: Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
The text was updated successfully, but these errors were encountered:
I agree that this should fail in a better way. I think for any graph creation, we should check the node count and if it is < 1 we should fail with a helpful message.
We should also check that this happens for native projections. We already fail for non-existent labels, but I'm not sure what happens for an existing, but empty label.
I just checked: if we try and natively project a label that exists but has a nodecount = 0, we just accept that. I think we should raise an error for this case consistent with your case detailed above.
A recently added config-parameter called validateRelationships, which is set to true by default for gds.graph.create.cypher now correctly throws an error: Failed to invoke procedure gds.graph.create.cypher: Caused by: java.lang.IllegalStateException: Failed to load relationship with unknown source-node id 0.
So the behavior should be fixed in the next release
Yes, using validateRelationships should help -- but we will also make the system refuse any graph without nodes consistently, regardless of the validateRelationships feature. Coming soon.
I stumbled upon this more by accident than anything. Basically, if we project 0 nodes and 1 relationship, we get the array index out of bounds exception. We could try and catch this error and return a more descriptive error such as "You failed to project any node" or something.
Create graph:
Project graph
We get the following error:
Failed to invoke procedure
gds.graph.create.cypher: Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
The text was updated successfully, but these errors were encountered: