Jonathan Fridja
Jonathan Fridja
ATApache TinkerPop
Created by Jonathan Fridja on 10/27/2024 in #questions
What's the significance of done: false ? (after calling .next())
Hi, I've encountered a query that I execute, and it usually never returns "done" false. But in a specific case, it does. I run 2 queries, and sometimes I'm not calling .next() or any terminal steps. I have tried looking for more information in the docs, to no avail. A link to the source code for the class that returns done: boolean: https://github.com/apache/tinkerpop/commit/d458f76dc3d464dae3a5e3bb3b28f63e5b3eead1
3 replies
ATApache TinkerPop
Created by Jonathan Fridja on 10/6/2024 in #questions
[Bug] clone query affects original cloned query
[X] I am using the latest release (3.7.2) I believe the clone function code in gremlin-javascript contains a bug: Notes: - I renamed process to gProcess as it's a global variable in Nodejs - The following code is written in Typescript
import { process as gProcess } from "gremlin";

export async function example(
q: gProcess.GraphTraversalSource<gProcess.GraphTraversal>
) {
const first = q.V().hasLabel("Book").range(0, 100);
const cloned = first.clone().count();

console.log("first.getByteCode()", first.getBytecode());
console.log("cloned.getByteCode()", cloned.getBytecode());
}
import { process as gProcess } from "gremlin";

export async function example(
q: gProcess.GraphTraversalSource<gProcess.GraphTraversal>
) {
const first = q.V().hasLabel("Book").range(0, 100);
const cloned = first.clone().count();

console.log("first.getByteCode()", first.getBytecode());
console.log("cloned.getByteCode()", cloned.getBytecode());
}
The example code outputs:
first.getByteCode() Bytecode {
sourceInstructions: [],
stepInstructions: [ [ 'V' ], [ 'hasLabel', 'Book' ], [ 'range', 0, 100 ], [ 'count' ] ]
}
cloned.getByteCode() Bytecode {
sourceInstructions: [],
stepInstructions: [ [ 'V' ], [ 'hasLabel', 'Book' ], [ 'range', 0, 100 ], [ 'count' ] ]
}
first.getByteCode() Bytecode {
sourceInstructions: [],
stepInstructions: [ [ 'V' ], [ 'hasLabel', 'Book' ], [ 'range', 0, 100 ], [ 'count' ] ]
}
cloned.getByteCode() Bytecode {
sourceInstructions: [],
stepInstructions: [ [ 'V' ], [ 'hasLabel', 'Book' ], [ 'range', 0, 100 ], [ 'count' ] ]
}
The count step affects both first and cloned. I may be using clone wrong, but the behavior I'm looking for is cloning an existing query. I have searched the source code and believe the clone function is improperly implemented. Commit it was added: https://github.com/apache/tinkerpop/commit/e3960486459152c31565642f772a8df0c57ca9f6#diff-38672d19a01405e314993c9e06586f19ef66b0a89f7c9f34d17273848cef3c1dR208 Thank you in advance 🙏
5 replies