GremlinGroovyScriptEngine to submit bytecode from string vs Client to submit query as string

Hey, Bit of a weird question here but I'm trying to decommission the (potentially never actually useful) use of the GremlinGroovyScriptEngine. "Historically" the GremlinGroovyScriptEngine was used to convert queries written in the query editor as String to bytecode for submission via a GraphTraversalSource generated in the backend. My question essentially is: can I completely rely on the Client instead to submit queries as string? The main limitation of the GremlinGroovyScriptEngine (groovy dependency aside) is that when submitting queries for non Gremlin technologies (e.g. JanusGraph) it leads to script execution errors when submitting JanusGraph specific predicates, for instance. I have a feeling the answer is "submit everything via client and it will work the same" but I'm just curious to know whether there's any fundamental difference in the way results are returned when submitting via client rather than bytecode
Solution:
i don't think there is much value to bytecode itself. that may sound weird because we promote use of bytecode so much, but we promote it more for the idea that you develop your applications without embedding scripts in your code and getting the development gains that come with using Gremlin as code itself. in your case, and similar tools, i think your Gremlin currency is the script and converting it to bytecode first for submission probably doesn't give you too much benefit and as you've found likely just gets in the way (you already outlined the problems with trying to transform those scripts for various graph providers).
As far as "fundamental differences" i don't think there are many and I assume you were doing a Client.submit() with your bytecode which means you were already dealing with a ResultSet object for your result so going to scripts should present no difference there....
Jump to solution
4 Replies
spmallette
spmallette2y ago
are you saying you just want to directly submit whatever query the user writes as a string directly to the server?
gdotv
gdotvOP2y ago
essentially yeah
Solution
spmallette
spmallette2y ago
i don't think there is much value to bytecode itself. that may sound weird because we promote use of bytecode so much, but we promote it more for the idea that you develop your applications without embedding scripts in your code and getting the development gains that come with using Gremlin as code itself. in your case, and similar tools, i think your Gremlin currency is the script and converting it to bytecode first for submission probably doesn't give you too much benefit and as you've found likely just gets in the way (you already outlined the problems with trying to transform those scripts for various graph providers).
As far as "fundamental differences" i don't think there are many and I assume you were doing a Client.submit() with your bytecode which means you were already dealing with a ResultSet object for your result so going to scripts should present no difference there.
gdotv
gdotvOP2y ago
yeah, i think the only difference here is handling the result set i think because by default it's sort of a list i lose the ability to tell apart lone results from lists (e.g. g.V().count().next() vs g.V().count().toList()) but i think i can get away with just checking the terminal step on the query and deciding from there i believe that answers my question, ill go ahead and mark this as resolved. getting rid of the gremlingroovyscriptengine would be a huge plus for g.V(), gonna try and get all that done and tested
Want results from more Discord servers?
Add your server