Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gds.graph.create.cypher ArrayIndexOutOfBoundsException error #15

Closed
tomasonjo opened this issue Mar 13, 2020 · 4 comments
Closed

gds.graph.create.cypher ArrayIndexOutOfBoundsException error #15

tomasonjo opened this issue Mar 13, 2020 · 4 comments
Labels
BUG Something isn't working error message

Comments

@tomasonjo
Copy link
Contributor

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

@Mats-SX Mats-SX added API BUG Something isn't working error message and removed API labels Mar 17, 2020
@Mats-SX
Copy link
Contributor

Mats-SX commented Mar 17, 2020

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.

@Mats-SX
Copy link
Contributor

Mats-SX commented Mar 17, 2020

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.

@FlorentinD
Copy link
Contributor

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

@Mats-SX
Copy link
Contributor

Mats-SX commented Mar 26, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BUG Something isn't working error message
Projects
None yet
Development

No branches or pull requests

3 participants