Dmitry, Alexey

Thank you for help, this answers help me a lot with understanding how
clients are work

Not so long time ago i met problem which is have expected behavior, but its
may broke some workflows in future for some users

Its all about not specified data types in collections and map's
All description and examples in
https://issues.apache.org/jira/browse/IGNITE-10358

Dmitry, can you have a quick look at it and maybe in future somehow fix it?

пт, 26 окт. 2018 г. в 19:05, Dmitry Melnichuk <
dmitry.melnic...@nobitlost.com>:

> Stepan!
>
> TL/DR: what you got with Python client in your gist is an intended
> behavior.
>
> Explanation: As per docs, Object array contains of type ID (which is
> defaults to -1) and an array of objects.
>
>
> https://apacheignite.readme.io/docs/binary-client-protocol-data-format#section-object-array
>
> Your gist might be fixed accordingly:
>
> ```
> from pyignite import Client
> from pyignite.datatypes import *
>
> OBJECT_ARRAY_TYPE_ID = -1
> OBJECT_ARRAY_CONTENTS = [1, 2]
>
> client = Client()
> client.connect('127.0.0.1', 10800)
> cache = client.get_or_create_cache("PY_OBJECT_ARRAY")
> cache.put(
>      1,
>      (OBJECT_ARRAY_TYPE_ID, OBJECT_ARRAY_CONTENTS),
>      key_hint=IntObject,
>      value_hint=ObjectArrayObject,
> )
>
> # Python  output: print(cache.get(1))
> # (-1, [1, 2])
> ```
>
> The situation is similar with Map and Collection, they have types. Types
> and type IDs are mostly useless in Python, but I left them for
> interoperability reasons. If you think I should kick them out, just let
> me know.
>
> The usage of these 3 data types is documented and tested. You can refer
> to the table in “Data types” section:
>
>
> https://apache-ignite-binary-protocol-client.readthedocs.io/en/latest/datatypes/parsers.html
>
> The tests are here:
>
>
> https://github.com/apache/ignite/blob/master/modules/platforms/python/tests/test_datatypes.py#L116-L124
>
> On 10/26/18 11:57 PM, Stepan Pilschikov wrote:
> > Hi, everyone
> >
> > Create new thread to centralize cross compatibility and others common
> > problems between thin clients
> >
> > Tying to use Object array to exchange different data between JS, PHP and
> > Python thin clients
> >
> > JS and PHP simply can't put any type of arrays
> > Python can put data, but if you take it, data would be completely
> > different, maybe during this put process data is changed
> >
> > Code and output:
> > PHP -
> https://gist.github.com/pilshchikov/e887d31d4f2f36923470fead14c7801a
> > JS -
> https://gist.github.com/pilshchikov/ba49067fd8924ebdf4414ec63838b86d
> > Python -
> > https://gist.github.com/pilshchikov/f4bbf76e31547e2dca7d4cc5d55bd24f
> >
> > I'm tried different data types (string, double, float, complex objects,
> > just random objects, char, byte, Date), still
> >
> > How, from my perspective, it should works:
> > put array of any type and then get this array.
> > Example: put [1,2,3] -> get [1,2,3] or put [new Date(), new Date()] ->
> > get [[Date object], [Date object]] (like in java thin client)
> >
> > Looks like bug in all clients, what you think?
> >
> > I wanted to try Collections, but i think this type have same problem
>

Reply via email to