-
Notifications
You must be signed in to change notification settings - Fork 28
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,16 +9,19 @@ public class IndexConstraintRelationshipInfo { | |
|
||
public final String name; | ||
|
||
public final Object type; | ||
public final String type; | ||
|
||
public final List<String> properties; | ||
|
||
public final String status; | ||
|
||
public final Object relationshipType; | ||
|
||
public IndexConstraintRelationshipInfo(String name, Object type, List<String> properties, String status) { | ||
public IndexConstraintRelationshipInfo(String name, String type, List<String> properties, String status, Object relationshipType) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we call this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, changing the name is a good idea, but maybe I would change the name to It would seem clearer to me even if this change will be made: #247 (review) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah fair enough, schemaType works better :) just internally anyway |
||
this.name = name; | ||
this.type = type; | ||
this.properties = properties; | ||
this.status = status; | ||
this.relationshipType = relationshipType; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -574,14 +574,15 @@ private IndexConstraintRelationshipInfo relationshipInfoFromIndexDescription(Ind | |
.mapToObj(tokens::propertyKeyGetName) | ||
.collect(Collectors.toList()); | ||
try { | ||
return new IndexConstraintRelationshipInfo(getSchemaInfoName(relName, properties), relName, properties, schemaRead.indexGetState(indexDescriptor).toString()); | ||
return new IndexConstraintRelationshipInfo(getSchemaInfoName(relName, properties), "INDEX", properties, schemaRead.indexGetState(indexDescriptor).toString(), relName); | ||
} catch (IndexNotFoundKernelException e) { | ||
return new IndexConstraintRelationshipInfo( | ||
// Pretty print for index name | ||
getSchemaInfoName(relName, properties), | ||
relName, | ||
"INDEX", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. above we check: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh you're right, I didn't remember about your card, I was referring to the current version. Updated :) |
||
properties, | ||
"NOT_FOUND" | ||
"NOT_FOUND", | ||
relName | ||
); | ||
} | ||
} | ||
|
@@ -597,7 +598,8 @@ private IndexConstraintRelationshipInfo relationshipInfoFromConstraintDefinition | |
String.format("CONSTRAINT %s", constraintDefinition.toString()), | ||
constraintDefinition.getConstraintType().name(), | ||
Iterables.asList(constraintDefinition.getPropertyKeys()), | ||
"" | ||
"", | ||
constraintDefinition.getRelationshipType().name() | ||
); | ||
} | ||
|
||
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 aList<String>
, in case of composite indexes, e.g. intestIndexesWithMultipleLabelsAndRelTypes
https://github.com/neo4j/apoc/pull/247/files/9b4b7bf4448cf27d6daff1f1bc9a9d44e23aa11e#diff-231d1cab850aaf45247b0fd9e1a64e18a8002685841df498e2098c38bedf6fb3R758There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah makes sense, thanks :)