ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitry Melnichuk <dmitry.melnic...@nobitlost.com>
Subject Re: Thin clients all in one
Date Sun, 25 Nov 2018 02:37:06 GMT
Stepan,

AFAIK Map type did always behave correctly on client side, as it does 
now. This is a corresponding piece of my test suite:

```
def test_put_get_map(client):

     cache = client.get_or_create_cache('test_map_cache')

     cache.put(
         'test_map',
         (
             MapObject.HASH_MAP,
             {
                 (123, IntObject): 'test_data',
                 456: ((1, [456, 'inner_test_string', 789]), 
CollectionObject),
                 'test_key': 32.4,
             }
         ),
         value_hint=MapObject
     )
     value = cache.get('test_map')
     assert value == (MapObject.HASH_MAP, {
         123: 'test_data',
         456: (1, [456, 'inner_test_string', 789]),
         'test_key': 32.4,
     })

```

Or is there another, more specific problem with maps?

Dmitry

On 11/25/18 3:56 AM, Stepan Pilschikov wrote:
> Dmitry,
> 
> Great, checked, now all things woks well
> Hope that Igor made review for this PR
> 
> But what about Maps? Looks like different ticket? or it can be done in same
> ticket scope?
> 
> пт, 23 нояб. 2018 г. в 23:58, Dmitry Melnichuk <
> dmitry.melnichuk@nobitlost.com>:
> 
>> Stepan,
>>
>> Sorry, I forgot to update from upstream prior to start working on this
>> issue, and thus brought a regression. My bad. Just merged with the
>> latest master. Please, check it out again.
>>
>> Dmitry
>>
>> On 11/24/18 1:37 AM, Stepan Pilschikov wrote:
>>> Dmitry,
>>>
>>> Iv checked and its actually work
>>> But a specially in this branch i found another bug
>>> Please look at my last comment:
>>>
>> https://issues.apache.org/jira/browse/IGNITE-10358?focusedCommentId=16697285&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-16697285
>>>
>>> пт, 23 нояб. 2018 г. в 01:21, Dmitry Melnichuk <
>>> dmitry.melnichuk@nobitlost.com>:
>>>
>>>> Stepan,
>>>>
>>>> Thank you for your great job in evaluating Python thin client, as well
>>>> as other thin clients.
>>>>
>>>> There was indeed a bug in Python client regarding the handling of type
>>>> hints in Collection type. I created a fix and did a PR under
>>>> IGNITE-10358 task, but the same PR is also fixes the problem in
>>>> IGNITE-10230 task.
>>>>
>>>> As of handling the type mapping in gists you provided, I left comments
>>>> on both tasks.
>>>>
>>>> Dmitry
>>>>
>>>> On 11/21/18 6:37 PM, Stepan Pilschikov wrote:
>>>>> 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.melnichuk@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
>>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>>
> 


Mime
View raw message