[
https://issues.apache.org/jira/browse/TINKERPOP-1063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15334588#comment-15334588
]
ASF GitHub Bot commented on TINKERPOP-1063:
-------------------------------------------
Github user dkuppitz commented on a diff in the pull request:
https://github.com/apache/tinkerpop/pull/342#discussion_r67415317
--- Diff:
tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
---
@@ -358,6 +350,14 @@ public Features features() {
return features;
}
+ private void validateHomogenousIds(final List<Object> ids) {
+ final Class firstClass = ids.get(0).getClass();
+ for (Object id : ids) {
+ if (!id.getClass().equals(firstClass))
+ throw Graph.Exceptions.idArgsMustBeEitherIdOrElement();
+ }
+ }
+
--- End diff --
This opens the door for NPE's.
```
gremlin> graph.vertices("a", null, 1)
java.lang.NullPointerException
Display stack trace? [yN] y
java.lang.NullPointerException
at
org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph.validateHomogenousIds(TinkerGraph.java:356)
at
org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph.createElementIterator(TinkerGraph.java:329)
at
org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph.vertices(TinkerGraph.java:269)
```
Suggestion with a few tweaks:
```
private void validateHomogenousIds(final List<Object> ids) {
final Iterator<Object> iterator = ids.iterator();
Object id = iterator.next();
if (id == null)
throw Graph.Exceptions.idArgsMustBeEitherIdOrElement();
final Class firstClass = id.getClass();
while (iterator.hasNext()) {
id = iterator.next();
if (id == null || !id.getClass().equals(firstClass))
throw Graph.Exceptions.idArgsMustBeEitherIdOrElement();
}
}
```
> TinkerGraph performance enhancements
> ------------------------------------
>
> Key: TINKERPOP-1063
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1063
> Project: TinkerPop
> Issue Type: Improvement
> Components: tinkergraph
> Affects Versions: 3.1.0-incubating
> Reporter: stephen mallette
> Assignee: stephen mallette
> Fix For: 3.1.3
>
>
> Improve TinkerGraph performance in relation to the Ferma Benchmark which
> shows a reasonably wide gap between TP2 and TP3. We probably won't achieve
> parity with Blueprints but it would be nice to carve away some time to lessen
> the gap.
> https://github.com/Syncleus/Ferma-benchmark
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)