[ 
https://issues.apache.org/jira/browse/TINKERPOP-2797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17602040#comment-17602040
 ] 

Yang Xia commented on TINKERPOP-2797:
-------------------------------------

Hi [~pkemkes] , thank you for raising the issue. This new error is due to the 
change in the default serialization format for python in 3.6.1 from GraphSON to 
GraphBinary, which is more strict in the number typing.

To bypass the error you could either change the serializer back to GraphSON 
when you create the drc:
g = traversal().withRemote(connection, 
message_serializer=gremlin_python.driver.serializer.GraphSONMessageSerializer())
(additional details see 
[https://tinkerpop.apache.org/docs/3.6.1/reference/#gremlin-python-configuration)]

Or you could use the `long()` helper converter from `statics.py`, to convert 
large numerical requests:
print(f"2147483647: \{g.V(gremlin_python.statics.long(2147483647)).hasNext()}")

> graph_traversal V() throws on IDs larger than 2^31
> --------------------------------------------------
>
>                 Key: TINKERPOP-2797
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2797
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: python
>    Affects Versions: 3.6.1
>         Environment: Windows 10, Python 3.10.6
>            Reporter: Phillip Kemkes
>            Priority: Major
>
> Hi,
> we've noticed that graph_traversal.py's V() does not take IDs larger or equal 
> to 2^31 from version 3.6.1 on. It still worked on version 3.6.0.
> The following code replicates the issue:
> {code:java}
> g = traversal().withRemote(connection)
> print(f"2147483647: {g.V(2147483647).hasNext()}")
> print(f"2147483648: {g.V(2147483648).hasNext()}") {code}
> On version 3.6.0 it produces the following output:
> {code:java}
> 2147483647: False
> 2147483648: True{code}
> Note: The first ID does not exist in our graph, the latter does.
> On version 3.6.1, it crashes and the following output is created:
> {code:java}
> 2147483647: False
> Traceback (most recent call last):
>   File "C:\tmp\struct-error-test.py", line 35, in <module>
>     print(f"2147483648: {g.V(2147483648).hasNext()}")
>   File "C:\tmp\venv\lib\site-packages\gremlin_python\process\traversal.py", 
> line 105, in hasNext
>     return self.has_next()
>   File "C:\tmp\venv\lib\site-packages\gremlin_python\process\traversal.py", 
> line 109, in has_next
>     self.traversal_strategies.apply_strategies(self)
>   File "C:\tmp\venv\lib\site-packages\gremlin_python\process\traversal.py", 
> line 682, in apply_strategies
>     traversal_strategy.apply(traversal)
>   File 
> "C:\tmp\venv\lib\site-packages\gremlin_python\driver\remote_connection.py", 
> line 78, in apply
>     remote_traversal = self.remote_connection.submit(traversal.bytecode)
>   File 
> "C:\tmp\venv\lib\site-packages\gremlin_python\driver\driver_remote_connection.py",
>  line 102, in submit
>     result_set = self._client.submit(bytecode, 
> request_options=self._extract_request_options(bytecode))
>   File "C:\tmp\venv\lib\site-packages\gremlin_python\driver\client.py", line 
> 149, in submit
>     return self.submit_async(message, bindings=bindings, 
> request_options=request_options).result()
>   File "C:\Program Files\Python310\lib\concurrent\futures\_base.py", line 
> 458, in result
>     return self.__get_result()
>   File "C:\Program Files\Python310\lib\concurrent\futures\_base.py", line 
> 403, in __get_result
>     raise self._exception
>   File "C:\tmp\venv\lib\site-packages\gremlin_python\driver\connection.py", 
> line 66, in cb
>     f.result()
>   File "C:\Program Files\Python310\lib\concurrent\futures\_base.py", line 
> 451, in result
>     return self.__get_result()
>   File "C:\Program Files\Python310\lib\concurrent\futures\_base.py", line 
> 403, in __get_result
>     raise self._exception
>   File "C:\Program Files\Python310\lib\concurrent\futures\thread.py", line 
> 58, in run
>     result = self.fn(*self.args, **self.kwargs)
>   File "C:\tmp\venv\lib\site-packages\gremlin_python\driver\protocol.py", 
> line 86, in write
>     message = self._message_serializer.serialize_message(request_id, 
> request_message)
>   File "C:\tmp\venv\lib\site-packages\gremlin_python\driver\serializer.py", 
> line 225, in serialize_message
>     args = processor_obj.get_op_args(op, args)
>   File "C:\tmp\venv\lib\site-packages\gremlin_python\driver\serializer.py", 
> line 48, in get_op_args
>     return op_method(args)
>   File "C:\tmp\venv\lib\site-packages\gremlin_python\driver\serializer.py", 
> line 88, in bytecode
>     args['gremlin'] = self._writer.to_dict(gremlin)
>   File 
> "C:\tmp\venv\lib\site-packages\gremlin_python\structure\io\graphbinaryV1.py", 
> line 168, in to_dict
>     return self.serializers[t].dictify(obj, self, to_extend)
>   File 
> "C:\tmp\venv\lib\site-packages\gremlin_python\structure\io\graphbinaryV1.py", 
> line 811, in dictify
>     writer.to_dict(arg, to_extend)
>   File 
> "C:\tmp\venv\lib\site-packages\gremlin_python\structure\io\graphbinaryV1.py", 
> line 168, in to_dict
>     return self.serializers[t].dictify(obj, self, to_extend)
>   File 
> "C:\tmp\venv\lib\site-packages\gremlin_python\structure\io\graphbinaryV1.py", 
> line 253, in dictify
>     to_extend.extend(cls.byte_format_pack(obj))
> struct.error: argument out of rangeProcess finished with exit code 1 {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to