platinummonkey / rexpro-python

Python RexPro Interface

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RexProSerializationException on com.thinkaurelius.titan.core.attribute.FullDouble

edi-bice opened this issue · comments

Script returning vertex which contains properties of such type fails with RexProSerializationException. Converting the properties to plain Double before returning vertex works.

Could you share your property configuration and stack trace? Also what version of titan are you using?

Titan 0.4.4
g.makeKey("areaTotal").dataType(FullDouble.class).make()

uri = 'http://dbpedia.org/resource/Albania'
dbscript = "def qry = g.V('uri',uri)\nreturn qry.hasNext() ? qry.next().areaTotal : null"
els = rexconn.execute(dbscript, {'uri':uri})
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/rexpro/connectors/base.py", line 398, in execute response.raise_exception()
File "/usr/local/lib/python2.7/dist-packages/rexpro/messages.py", line 205, in
raise_exception
raise exceptions.RexProSerializationException(self.message)
rexpro.exceptions.RexProSerializationException: Script was successfully executed
but the result of the script was not properly serialized.

This seems to be a msgpack serialization problem between the different versions.

Older References:

conn = self.get_connection(graphname='graph')

script = "try { g.makeKey('testdouble').dataType(FullDouble.class).make() } catch (err) { }; v = g.addVertex(); v.testdouble = 1.2345678901234567890; g.commit(); return v"

response = conn.execute(script, {})

print dir(response)

with extended debugging yeilds that in fact the raw message sent from the server is:

bytearray(b'\x94\xb0\x8d&\xcbL]4Kn\x88\x1a\xfd\xc6\x8fV^\xf1\xb0e\xc2\x14\xd0a\x0b\x11\xe4\xa3H\x90\xb1\x1c\x91b6\x81\xa4flag\x06\xda\x00ZScript was successfully executed but the result of the script was not properly serialized.')

msgpack.loads(...) -> ['\x8d&\xcbL]4Kn\x88\x1a\xfd\xc6\x8fV^\xf1', 'e\xc2\x14\xd0a\x0b\x11\xe4\xa3H\x90\xb1\x1c\x91b6', {'flag': 6}, 'Script was successfully executed but the result of the script was not properly serialized.']

This seems to affect Titan 0.4.4, however testing against 0.5.1 these pass. bde8452

My only suggestion given that this is caused upstream, is to continue casting to standard floats or upgrade Titan.

Sounds good. Will continue casting and upgrade to 0.5 soon. Thanks for looking into it.