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

[Zl3h9sM8] apoc.schema.relationships return wrong output for relationship indexes #247

Merged
merged 3 commits into from
Nov 24, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions common/src/main/java/apoc/result/IndexConstraintNodeInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@ public class IndexConstraintNodeInfo {
* @param label
* @param properties
* @param status status of the index, if it's a constraint it will be empty
* @param type if it is an index type will be "INDEX" otherwise it will be the type of constraint
* @param schemaType if it is an index type will be "INDEX" otherwise it will be the type of constraint
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realise now this probably changes the actual output? because we probably don't want to do that 🙈

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually not, because the output in handled by the field, so public final String type; in this case.
Now I have a doubt, is this what you meant by "internally"?
If not, I can reset it :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, you're correct! This is good then :)

* @param failure
* @param populationProgress
* @param size
* @param userDescription
*/
public IndexConstraintNodeInfo(String name, Object label, List<String> properties, String status, String type, String failure, float populationProgress, long size, double valuesSelectivity, String userDescription) {
public IndexConstraintNodeInfo(String name, Object label, List<String> properties, String status, String schemaType, String failure, float populationProgress, long size, double valuesSelectivity, String userDescription) {
this.name = name;
this.label = label;
this.properties = properties;
this.status = status;
this.type = type;
this.type = schemaType;
this.failure = failure;
this.populationProgress = populationProgress;
this.size = size;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ public class IndexConstraintRelationshipInfo {

public final Object relationshipType;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this an Object? (I see it was before as well), but is it not just a string?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because relationshipType can also be a List<String>, in case of composite indexes, e.g. in testIndexesWithMultipleLabelsAndRelTypes https://github.com/neo4j/apoc/pull/247/files/9b4b7bf4448cf27d6daff1f1bc9a9d44e23aa11e#diff-231d1cab850aaf45247b0fd9e1a64e18a8002685841df498e2098c38bedf6fb3R758

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah makes sense, thanks :)


public IndexConstraintRelationshipInfo(String name, String type, List<String> properties, String status, Object relationshipType) {
public IndexConstraintRelationshipInfo(String name, String schemaType, List<String> properties, String status, Object relationshipType) {
this.name = name;
this.type = type;
this.type = schemaType;
this.properties = properties;
this.status = status;
this.relationshipType = relationshipType;
Expand Down