Painguin | Tiến
Painguin | Tiến
Explore posts from servers
ATApache TinkerPop
Created by Painguin | Tiến on 5/8/2024 in #questions
`next(n)` with Gremlin JavaScript
No description
17 replies
ATApache TinkerPop
Created by Painguin | Tiến on 5/4/2024 in #questions
TraversalInterruptionTest taking a very long time to complete
There's a try & sleep step in these tests: https://github.com/tien/tinkerpop/blob/a919b90ebe31434e306609a2d2a37702eead02d7/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalInterruptionTest.java#L86 https://github.com/tien/tinkerpop/blob/a919b90ebe31434e306609a2d2a37702eead02d7/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalInterruptionComputerTest.java#L78 Which caused the last test case outlined below to take a very long time to complete (several hours to complete on CI) Testcase:
{"g_E_properties", (Function<GraphTraversalSource, GraphTraversal<?,?>>) g -> g.E().properties()},
{"g_E_properties", (Function<GraphTraversalSource, GraphTraversal<?,?>>) g -> g.E().properties()},
The test appear to also work when I remove the try->sleep & run it locally. Can this be removed? It's right now causing Janusgraph CI to take several hours to complete tests for every DB adapter. cc @spmallette
37 replies
ATApache TinkerPop
Created by Painguin | Tiến on 5/3/2024 in #questions
Running Tinkerpop test in Janusgraph repo
Hi I'm trying to run the below Tinkerpop test to test out some of the changes I've made to Janusgraph. By copying the test over from Tinkerpop repo into Janusgraph repo (just for testing one test).
@RunWith(Parameterized.class)
public class TraversalInterruptionTest extends AbstractGremlinProcessTest {
private static final Logger logger = LoggerFactory.getLogger(TraversalInterruptionTest.class);

@Parameterized.Parameters(name = "expectInterruption({0})")
public static Iterable<Object[]> data() {
return Arrays.asList(new Object[][]{
// ...
});
}

@Parameterized.Parameter(value = 0)
public String name;

@Parameterized.Parameter(value = 1)
public Function<GraphTraversalSource,GraphTraversal<?,?>> traversalBeforePause;

@Parameterized.Parameter(value = 2)
public UnaryOperator<GraphTraversal<?,?>> traversalAfterPause;

@Test
@LoadGraphWith(GRATEFUL)
public void shouldRespectThreadInterruptionInVertexStep() throws Exception {
// ...
}
}
@RunWith(Parameterized.class)
public class TraversalInterruptionTest extends AbstractGremlinProcessTest {
private static final Logger logger = LoggerFactory.getLogger(TraversalInterruptionTest.class);

@Parameterized.Parameters(name = "expectInterruption({0})")
public static Iterable<Object[]> data() {
return Arrays.asList(new Object[][]{
// ...
});
}

@Parameterized.Parameter(value = 0)
public String name;

@Parameterized.Parameter(value = 1)
public Function<GraphTraversalSource,GraphTraversal<?,?>> traversalBeforePause;

@Parameterized.Parameter(value = 2)
public UnaryOperator<GraphTraversal<?,?>> traversalAfterPause;

@Test
@LoadGraphWith(GRATEFUL)
public void shouldRespectThreadInterruptionInVertexStep() throws Exception {
// ...
}
}
But I'm getting
java.lang.NullPointerException: Cannot invoke "org.apache.tinkerpop.gremlin.GraphProvider.getStaticFeatures()" because "this.innerGraphProvider" is null
java.lang.NullPointerException: Cannot invoke "org.apache.tinkerpop.gremlin.GraphProvider.getStaticFeatures()" because "this.innerGraphProvider" is null
I need to be able to inject the graph implementation into this test somehow? How can I do that? Thank you.
11 replies
ATApache TinkerPop
Created by Painguin | Tiến on 4/24/2024 in #questions
Query optimisation
Hey, I'm optimising some queries, and found that these 2 seemingly identical queries behave very differently in term of performance
g.V().
union(
has("account", "id", "my_account"),
has("account", "id", "my_account").
out("owns")).
union(
out("completed").values("points"),
inE("rewarded").has("claimed", true).values("points")).
sum().
next()
g.V().
union(
has("account", "id", "my_account"),
has("account", "id", "my_account").
out("owns")).
union(
out("completed").values("points"),
inE("rewarded").has("claimed", true).values("points")).
sum().
next()
vs
g.V().
has("account", "id", "my_account").
union(identity(), out("owns")).
union(
out("completed").values("points"),
inE("rewarded").has("claimed", true).values("points")).
sum().
next()
g.V().
has("account", "id", "my_account").
union(identity(), out("owns")).
union(
out("completed").values("points"),
inE("rewarded").has("claimed", true).values("points")).
sum().
next()
The 2nd query performed about 10 times faster than the first. Can anyone with experience let me know what's the different for the 2? And what I should watch out for to avoid bad performing query like the first one? Thank you.
12 replies
ATApache TinkerPop
Created by Painguin | Tiến on 3/4/2024 in #questions
Concurrent queries to authentication required sever resulted in 401 error
Hey guys, playing around with gremlin & encountered this very odd error where concurrent queries will break authentication:
import gremlin from "gremlin";

const g = gremlin.process.AnonymousTraversalSource.traversal().withRemote(
new gremlin.driver.DriverRemoteConnection("ws://localhost:8182/gremlin", {
authenticator: new gremlin.driver.auth.PlainTextSaslAuthenticator(
"admin",
"administrator"
),
})
);

// This will throws: Failed to authenticate (401)
await Promise.all([g.V().toList(), g.V().toList()]);

// This works as expected
await g.V().toList();
await g.V().toList();
import gremlin from "gremlin";

const g = gremlin.process.AnonymousTraversalSource.traversal().withRemote(
new gremlin.driver.DriverRemoteConnection("ws://localhost:8182/gremlin", {
authenticator: new gremlin.driver.auth.PlainTextSaslAuthenticator(
"admin",
"administrator"
),
})
);

// This will throws: Failed to authenticate (401)
await Promise.all([g.V().toList(), g.V().toList()]);

// This works as expected
await g.V().toList();
await g.V().toList();
12 replies
ATApache TinkerPop
Created by Painguin | Tiến on 2/26/2024 in #questions
Returned vertex properties (JS client)
Hi, I've got a question regarding the returned vertex value when using the JS client. How come non-array properties are parsed & returned as an array of length 1, as seen in the example below? Thank you.
{
"id": 4104,
"label": "account",
"properties": {
"createdAt": [
{
"id": { "relationId": "16p-360-1l1" },
"label": "createdAt",
"value": "2024-02-26T22:06:11.873Z",
"key": "createdAt"
}
],
"address": [
{
"id": { "relationId": "1kx-360-2dh" },
"label": "address",
"value": "some_address",
"key": "address"
}
]
}
}
{
"id": 4104,
"label": "account",
"properties": {
"createdAt": [
{
"id": { "relationId": "16p-360-1l1" },
"label": "createdAt",
"value": "2024-02-26T22:06:11.873Z",
"key": "createdAt"
}
],
"address": [
{
"id": { "relationId": "1kx-360-2dh" },
"label": "address",
"value": "some_address",
"key": "address"
}
]
}
}
5 replies