Enable setting custom vertex ids in TP3 interface #147 #148
Enable setting custom vertex ids in TP3 interface #147 #148amcp merged 2 commits intoJanusGraph:masterfrom
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
sjudeng
left a comment
There was a problem hiding this comment.
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 <amcp@amazon.co.jp>
… user vertex ids and valid JanusGraph vertex ids. Signed-off-by: sjudeng <sjudeng@users.noreply.github.com>
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.
| * @return a corresponding JanusGraph vertex id | ||
| * @see #fromVertexId(long) | ||
| */ | ||
| public long toVertexId(long id) { |
There was a problem hiding this comment.
@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) { |
|
@sjudeng I agree we need another review. |
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 amcp@amazon.co.jp