-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Enable setting custom vertex ids in TP3 interface #147 #148
Conversation
I wonder if this might solve the issue I saw with custom vertex ids in upgrading to TinkerPop 3.2.3 (see notes in #78). To resolve there I updated test GraphComputerImplementations to include configuration around id generation but I wasn't happy with that approach. |
@sjudeng I've got to put in for the night it being 2AM here, but if this interests you and given the extremely small size of the fix I encourage you to pick up from here and rip out the config workaround you put in GraphComputerImplementations to see if it fixes the issue you encountered. |
I took a look at this branch. Initially I was having test failures of the form --- a/janusgraph-core/src/main/java/org/janusgraph/graphdb/tinkerpop/JanusGraphBlueprintsTransaction.java
+++ b/janusgraph-core/src/main/java/org/janusgraph/graphdb/tinkerpop/JanusGraphBlueprintsTransaction.java
@@ -115,7 +115,8 @@ public abstract class JanusGraphBlueprintsTransaction implements JanusGraphTrans
label = (labelValue instanceof VertexLabel)?(VertexLabel)labelValue:getOrCreateVertexLabel((String) labelValue);
}
- final JanusGraphVertex vertex = addVertex(ElementHelper.getIdValue(keyValues).orElse(null), label);
+ final Number id = (Number) ElementHelper.getIdValue(keyValues).orElse(null);
+ JanusGraphVertex vertex = addVertex(id != null ? id.longValue() : null, label); I then tried running through tests in the PeerPressureTest suite via InMemoryJanusGraphComputerTest, which use custom vertex ids. But these gave errors at StandardJanusGraphTx.java#L514. I experimented with an additional conditional there for |
ac5172d
to
15ca90c
Compare
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.
See note above regarding build errors. I'll try to look at this as well when I get some time.
Signed-off-by: Alexander Patrikalakis <[email protected]>
… user vertex ids and valid JanusGraph vertex ids. Signed-off-by: sjudeng <[email protected]>
15ca90c
to
e34815e
Compare
@amcp I rebased and added a commit to this PR. The commit includes a fix to JanusGraphBlueprintsTransaction to resolve test failures as described in the comment above. Also during testing I found that the existing documented method for converting user ids to vertex ids, All default and TinkerPop tests are passing with these updates. Given my involvement in the implementation I think it would be best to have another independent review. |
Dismissing my review since I contributed to the implementation.
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.
minor comments.
* @return a corresponding JanusGraph vertex id | ||
* @see #fromVertexId(long) | ||
*/ | ||
public long toVertexId(long id) { |
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.
can you test this method?
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.
@amcp There's a test added as part of the commit (see VertexIDAssignerTest#testCustomIdAssignment).
* @return original user provided id | ||
* @see #toVertexId(long) | ||
*/ | ||
public long fromVertexId(long id) { |
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.
can you test this method?
@sjudeng I agree we need another review. |
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.
Let's merge.
Enable setting custom vertex ids in TP3 interface JanusGraph#147
Enable setting custom vertex ids in TP3 interface JanusGraph#147
fixes #147, another bug fix that didn't make it into Titan by the end of 2015
Signed-off-by: Alexander Patrikalakis [email protected]