choose().option() switch case is not working for byte value

76 views
Skip to first unread message

Ajay Choudary

unread,
Jul 13, 2018, 10:26:08 AM7/13/18
to Gremlin-users

Am using janusGraph-0.2.0

choose().option().option() chain is working with strings, integers & edge labels etc

But if choosen value is of type Byte.class, then always none option is executing.


Working query with Interger value:
> g.V().hasLabel("knowledge").has('views', 67).choose(values('views')).option(67, values('views')).option(none, constant('0'))
 67

Not working query with Byte value:
> g.V().hasLabel('knowledge').bothE('sharedTo').has('privilege', 2).choose(values('privilege')).option(2, values('privilege')).option(none, constant(0))
0

Any idea, how can i pass byte value to option.

Stephen Mallette

unread,
Jul 16, 2018, 6:41:42 AM7/16/18
to Gremlin-users
This might be a problem with JanusGraph because I'm not seeing the problem on TinkerGraph:

gremlin> b = 1 as byte
==>1
gremlin> b.class
==>class java.lang.Byte
gremlin> g.V(1).property('b',b)
==>v[1]
gremlin> g.V(1).choose(values('b')).option(b, constant(true)).option(none,constant(false))
==>true

If that's not representative of your problem please let us know, but I think you might want to bring that up on the JanusGraph list (unless some JanusGraph heroes can help here).



--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/0c52bc5a-998a-49ba-9ef8-3462485e731f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jason Plurad

unread,
Jul 16, 2018, 10:18:33 AM7/16/18
to Gremlin-users
This isn't specific to JanusGraph. The issue is the option comparison is using an integer rather than a byte. Continuing on Stephen's example:

gremlin> g.V(1).choose(values('b')).option(b, constant(true)).option(none,constant(false))
==>true

gremlin
> g.V(1).choose(values('b')).option(1, constant(true)).option(none,constant(false))
==>false
gremlin
> g.V(1).choose(values('b')).option(1 as byte, constant(true)).option(none,constant(false))
==>true

Stephen Mallette

unread,
Jul 16, 2018, 10:20:04 AM7/16/18
to Gremlin-users
oh - sorry - i'm not smart.....stupid Java number comparisons......

Kuppitz should NumberHelper be used here?

Daniel Kuppitz

unread,
Jul 16, 2018, 12:28:58 PM7/16/18
to gremli...@googlegroups.com
Yea, we can do that (and we should). I guess this only requires a few minor changes in BranchStep.

Cheers,
Daniel


To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-users+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/CAA-H43-%3DewuyjOGjwyKatR6tXw22XuH2J9tCORtZu6ycv8MkvA%40mail.gmail.com.

Ajay Choudary

unread,
Jul 17, 2018, 7:42:21 AM7/17/18
to Gremlin-users
Thanks Jason Plurad & Stephen Mallette.
Its working fine now.

Stephen Mallette

unread,
Jul 17, 2018, 8:06:53 AM7/17/18
to Gremlin-users

On Tue, Jul 17, 2018 at 7:42 AM Ajay Choudary <aja...@gmail.com> wrote:
Thanks Jason Plurad & Stephen Mallette.
Its working fine now.

--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages