AT
Apache TinkerPopdanielcraig23

Does .math() always return a Double?

I have the following query, how can I get the result as a Long instead of a Double? In context, I want this query to be unioned with a set of other numbers which are Longs and then I want to take the .max() of them. But I can't do that if I have a mix of Long and Double
Long tenHours = Long.valueOf(Duration.ofHours(10).toMillis());

g.withSideEffect("tenHours", tenHours).inject(1689570000000L).math("_ + tenHours").next().getClass()
Long tenHours = Long.valueOf(Duration.ofHours(10).toMillis());

g.withSideEffect("tenHours", tenHours).inject(1689570000000L).math("_ + tenHours").next().getClass()
D
danielcraig23235d ago
I need .math() to return a Long I have discovered a workaround, but it's a little bit awkward.
S
spmallette234d ago
there has been some discussion of adding more type conversion steps as first-class citizens. until then there aren't too many options for changing types in Gremlin. it generally something left for the client-side.
Want results from more Discord servers?
Add your server
More Posts
Trying to update a property value based on another propertyI have a query that looks something like the following g.V('9999').hasLabel('someLabel').propertiesCasting issue with Gremlin JavaI wrote the following query and I can't get it to compile, tried a ton of casting but it just isn't valueMap and MultivaluesI was going to use the recipe from @KelvinL 's book to return lists only when the property has multiAWS Neptune bulk load notificationsI wonder if anyone has knowledge of a way to receive a notification event(s) for bulk loading. RightVertexProgram filter graph before terminationI have a VertexProgram that operates on vertices of type A and B. B vertices are "below" A verticesStraightforward way to render a force directed graph svg/pngI was wondering if there is a "simple" way in java for me to take a GraphTraversal and render a forcCan't do explain() traversal step using Gremlin-Python ..Hi I just started messing around in gremlin-python this week, so likely to be doing something wrong Gremlin Query for amount of time and return all results?Is there a way to make gremlin keep running until time elapses then return the results? I have a queHow do I make a ssl connection using only ARN from neptune (AWS)I have a simple connection in my project using remotecon = DriverRemoteConnection(neptune_url) But Can gremlin-server be started via its Java packageI'm considering exposing the G.V() Playground graphs, which runs on TinkerGraph, to the network via Getting Property Out of a Variable in Python Gremlin QueryI've been working on attempting to find a performance way to route from point A to point B. Right nThe Cascading Coalescing - Create a V then Create an E in One ShotI have been struggling with this and perhaps I can ask some expert on how to approach this type of i