[
https://issues.apache.org/jira/browse/TINKERPOP-2252?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16877783#comment-16877783
]
stephen mallette commented on TINKERPOP-2252:
---------------------------------------------
After some thought....I'm really not in favor of promoting sessions as a way to
build applications, so that use case as reasoning for the change isn't so
compelling to me. I do however think that there is some value in parameterized
translation. I suppose that there is no concern about gathering the parameters
the way that you are - at least, I can't think of any problems that it presents
right now. Under your model the following would all compile to the same script:
{code}
g.addV('person').property('name','stephen').property('active',true)
g.addV('animal').property('species','u americanus').property('genus','ursus')
g.addV('product').property('type','toy').property('name','teddy bear')
{code}
I can't think of why that would be bad (and I don't know why it is nagging at
me). It technically increases the chance of a single cache hit, whereas I'd
imagine manual parameterization would probably result in three separate cache
entries as they probably would be manually written as:
{code}
g.addV('person').property('name',x).property('active',y)
g.addV('animal').property('species',x).property('genus',y)
g.addV('product').property('type',x).property('name',y)
{code}
If you would like to submit the PR, I think you should create a
{{ParameterizedGroovyTranslator}} (i.e. don't change {{GroovyTranslator}} as we
need that to continue to work the way that it is and I think that mixing the
features of the two doesn't fit the {{ScriptTranslator}} model well. To
validate the functionality of your translator you need to add tests that are
along the lines of the ones found here:
https://github.com/apache/tinkerpop/tree/master/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223
I'm not completely sure where you're going with the {{Bindings}} class - it
seems you have a significant amount of change to that. Perhaps it will all make
more sense when I can see the PR as a whole in a diff. Perhaps you don't need
those changes if you build a separate {{ScriptTranslator}} as I requested above
(in other words, you would need a new "Bindings" class with that functionality
in your screenshot)?
Please target the "master" branch with this change as I believe this
functionality should be targeted for 3.5.0. Thanks for offering this idea and
I'll keep an eye out for your pull request. Take care!
> a meaningful way to support session based byteCode interaction through
> gremlin-driver
> ---------------------------------------------------------------------------------------
>
> Key: TINKERPOP-2252
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2252
> Project: TinkerPop
> Issue Type: Improvement
> Components: groovy
> Affects Versions: 3.3.3
> Reporter: Stark Arya
> Priority: Major
> Attachments: image-2019-07-02-10-23-50-901.png,
> image-2019-07-02-22-04-16-651.png, image-2019-07-02-22-05-38-063.png,
> image-2019-07-02-22-19-19-539.png
>
>
> As in topic
> [https://groups.google.com/forum/#!topic/gremlin-users/cHl4FB-H7Nc] we have
> discussed,TinkerPop currently support:
> # Script sessionLess which is auto transaction;
> # ByteCode sessionLess which is also auto transaction;
> # Script session which user could control transaction through g.tx().open /
> rollback / commit;
> As we knows that ByteCode based requests are themselves code written in the
> native language and could be checked to validate the Gremlin during the
> development process。 => so many user prefer to use ByteCode over Script。
> But as we known,auto transaction need to persistence data changes per request
> which needs high cost and in some scenarios user even unbearable。=> so in
> some performance sensitive situation user prefer to use sessionBased
> interaction over sessionLess。
> Here,we face the real trouble: if user need both high performance and good
> write experience,we sank into despair because we do not support byteCode
> session,here is another user‘s
> sample:[https://stackoverflow.com/questions/55454068/tinkerpop-gremlin-transaction-processor-with-bytecode]。
> We must solve this problem even it is in less use because we all want to
> provide sufficiently good service to our user,but better transaction support
> in TP4 is still far away。 Here is my simple and meaningful solution:
> We can provide a function which change byteCode into Parameterized Scripts
> (not a simple Script which we already have, Its performance is 10X lower) 。
> Yes,we just need to add a new translate function in
> "org.apache.tinkerpop.gremlin.groovy.jsr223.GroovyTranslator.java"。
> The code is ready and through test, if anyone agree that this it's
> meaningful, i will submit PR later, thanks for your patience。
> The user code would like:
> !image-2019-07-02-10-23-50-901.png!
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)