You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/10/19 21:50:00 UTC

[jira] [Commented] (IGNITE-9950) thin python: Decimal data type didn't match with others clients

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

ASF GitHub Bot commented on IGNITE-9950:
----------------------------------------

GitHub user dmelnichuk opened a pull request:

    https://github.com/apache/ignite/pull/5041

    IGNITE-9950

    Fix decimal format.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/nobitlost/ignite ignite-9950

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/ignite/pull/5041.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #5041
    
----
commit 4b444df0000f62c04b97bc2cdb0676ad52880374
Author: ekaterina-nbl <ek...@...>
Date:   2018-03-20T21:12:21Z

    initial implementation

commit d1e8014c80f698028d23e09cafd7ea190ac3e929
Author: ekaterina-nbl <ek...@...>
Date:   2018-03-20T21:32:52Z

    initial implementation

commit f79229e233ffa7bff1e7c22f04749924af6d712a
Author: ekaterina-nbl <ek...@...>
Date:   2018-03-22T09:39:32Z

    initial implementation

commit 658d60b58840080b664e02815f4ba6aac76e5804
Author: ekaterina-nbl <ek...@...>
Date:   2018-03-22T16:52:18Z

    minor update

commit 617cef12ad72791c7e7e67179e1b0c3f7f3ae6bb
Author: ekaterina-nbl <ek...@...>
Date:   2018-03-25T13:33:27Z

    api spec

commit d9729585f5a901977e2a2e40e86a2b715fab79fa
Author: alexey-nbl <al...@...>
Date:   2018-03-25T21:27:11Z

    link to api_spec added

commit ea847eba62e556fa81cbf9838ffe17af60f464e4
Author: ekaterina-nbl <ek...@...>
Date:   2018-03-31T22:07:50Z

    error types modified

commit c2ad53fe625cc3a05155eeef3184215388377770
Author: ekaterina-nbl <ek...@...>
Date:   2018-03-31T23:41:56Z

    client states

commit 6d2233864b4d891361d38a7143846570bd6c0ef6
Author: ekaterina-nbl <ek...@...>
Date:   2018-04-01T13:11:27Z

    object types improvement

commit 52fbc5f87143da068596141cb59b17b684fd2c1f
Author: ekaterina-nbl <ek...@...>
Date:   2018-04-02T16:59:52Z

    complex objects

commit cae5a28e7e0d610434debcc140738e2f48d061cf
Author: ekaterina-nbl <ek...@...>
Date:   2018-04-02T20:13:00Z

    object types improvement

commit 3165405d4eae09519dc9b5f40f162eb74a9b3c5d
Author: ekaterina-nbl <ek...@...>
Date:   2018-04-02T21:21:26Z

    client states

commit fdbb8f86b32fe4c038d38620a80921be3038f31f
Author: alexey-nbl <al...@...>
Date:   2018-04-03T08:26:04Z

    Ignite client states described

commit 04b946885db0ea2f6fe56a75e28302641dad5f61
Author: alexey-nbl <al...@...>
Date:   2018-04-03T09:35:49Z

    minor update

commit f4aaf1c3f23c82ba7974b4c571a9984748e5e82e
Author: alexey-nbl <al...@...>
Date:   2018-04-03T12:47:54Z

    Update ObjectType.js

commit e4c8279f4e83b3ed13383420ab3d1417b090a3fa
Author: ekaterina-nbl <ek...@...>
Date:   2018-04-03T13:46:19Z

    minor updates + api spec

commit ed2e4ee830ca40a28dc31958665f52fab6a0bcdd
Author: alexey-nbl <al...@...>
Date:   2018-04-04T14:34:52Z

    Update ObjectType.js

commit 7e1666eb5df82b622a028c0ea949fa21c79e66c2
Author: alexey-nbl <al...@...>
Date:   2018-04-04T15:14:00Z

    Update ObjectType.js

commit 7b0270d65b597dc1b0d164e78f07c3a21c37ca67
Author: ekaterina-nbl <ek...@...>
Date:   2018-04-08T17:16:43Z

    sql queries, key value ops

commit fe90f53fd08f77add17fbf06d014f9a9b0a11c65
Author: alexey-nbl <al...@...>
Date:   2018-04-08T18:31:47Z

    Update IgniteClient.js

commit 04137bf5ec3b7077e194edd0100a01bb43f7933a
Author: alexey-nbl <al...@...>
Date:   2018-04-08T18:37:04Z

    Update CacheConfiguration.js

commit b63ad5980718da1b0c44fa4ca138c6e85e47aef3
Author: alexey-nbl <al...@...>
Date:   2018-04-08T19:11:11Z

    Update ObjectType.js

commit 756b908c9dc38ae497e4d7d740f836dabed93e48
Author: alexey-nbl <al...@...>
Date:   2018-04-08T22:41:54Z

    Update CacheClient.js

commit e96ffee17298dd25d26a7029738132478271cf92
Author: ekaterina-nbl <ek...@...>
Date:   2018-04-08T23:23:33Z

    object array, minor updates

commit c050e671f74232c4efc41f51c2018d08b152cbbc
Author: alexey-nbl <al...@...>
Date:   2018-04-09T21:04:35Z

    Update CacheClient.js

commit 25052a4e93d6fcc0b0c4789fdd5a1eb85413b5a2
Author: alexey-nbl <al...@...>
Date:   2018-04-09T22:43:50Z

    Update ObjectType.js

commit c516b4147c10398d4f34d78a8830dd0fcb5f28f4
Author: alexey-nbl <al...@...>
Date:   2018-04-10T11:50:13Z

    Update CacheClient.js

commit 0e9924a0df8a1d41718fb929698b8e4416f2efa2
Author: ekaterina-nbl <ek...@...>
Date:   2018-04-10T13:21:16Z

    cache key value operations tests

commit e09ee0e7969bffd6f4cfd11579f6d0ff9b486c99
Author: ekaterina-nbl <ek...@...>
Date:   2018-04-10T13:21:50Z

    Merge branch 'master' of https://github.com/nobitlost/ignite

commit 15d2abce41b4f1c9d4d5fecd44a99a5393177482
Author: alexey-nbl <al...@...>
Date:   2018-04-10T14:38:57Z

    Update Query.js

----


> thin python: Decimal data type didn't match with others clients
> ---------------------------------------------------------------
>
>                 Key: IGNITE-9950
>                 URL: https://issues.apache.org/jira/browse/IGNITE-9950
>             Project: Ignite
>          Issue Type: Bug
>          Components: thin client
>    Affects Versions: 2.7
>         Environment: Ignite 2.7 latest sources
> default cache configuration
> Python 3.7
> nodejs 10+
> PHP 7.2+
> Ubuntu 17
>            Reporter: Stepan Pilschikov
>            Assignee: Dmitry Melnichuk
>            Priority: Major
>
> Trying to put Decimal value from JS or PHP client and get with Python, but exception throwing
> JS code:
> {code}
> IgniteClient = require('apache-ignite-client');
> IgniteClientConfiguration = IgniteClient.IgniteClientConfiguration;
> const Decimal = IgniteClient.Decimal;
> const ObjectType = IgniteClient.ObjectType;
> ENDPOINT = '127.0.0.1:10800';
> igniteClient = new IgniteClient();
> async function start() {
>     await igniteClient.connect(new IgniteClientConfiguration(ENDPOINT));
>     try {
>         cache = (await igniteClient.getOrCreateCache("JS_DECIMAL"))
>                     .setKeyType(ObjectType.PRIMITIVE_TYPE.INTEGER)
>                     .setValueType(ObjectType.PRIMITIVE_TYPE.DECIMAL);
>         await cache.put(1, new Decimal('7.7'));
>     } finally {
>         igniteClient.disconnect();
>     }
> }
> start();
> {code}
> Python get code
> {code}
> from pyignite import Client
> from pyignite.datatypes import *
> client = Client()
> client.connect('127.0.0.1', 10800)
> cache = client.get_or_create_cache("JS_DECIMAL")
> print(str(cache.get(1, key_hint=IntObject)))
> {code}
> exception in python
> {code}
> Traceback (most recent call last):
>   File get_value_JS_DECIMAL.py", line 7, in <module>
>     print(str(cache.get(1, key_hint=IntObject)))
>   File "[ignite_src]/platforms/python/pyignite/utils.py", line 163, in ste_wrapper
>     result = fn(*args, **kwargs)
>   File "[ignite_src]/platforms/python/pyignite/cache.py", line 200, in get
>     result = cache_get(self._client, self._cache_id, key, key_hint=key_hint)
>   File "[ignite_src]/platforms/python/pyignite/api/key_value.py", line 107, in cache_get
>     ('value', AnyDataObject),
>   File "[ignite_src]/platforms/python/pyignite/queries/__init__.py", line 291, in perform
>     result.value = response_struct.to_python(response)
>   File "[ignite_src]/platforms/python/pyignite/queries/__init__.py", line 96, in to_python
>     *args, **kwargs
>   File "[ignite_src]/platforms/python/pyignite/datatypes/internal.py", line 288, in to_python
>     return data_class.to_python(ctype_object)
>   File "[ignite_src]/platforms/python/pyignite/datatypes/standard.py", line 183, in to_python
>     result = decimal.Decimal(data.decode(PROTOCOL_STRING_ENCODING))
> decimal.InvalidOperation: [<class 'decimal.ConversionSyntax'>]
> {code}
> When trying with PHP have same exception
> Also when use Decimal from Python others clients return different value:
> Python decimal put code
> {code} 
> from pyignite import Client
> from pyignite.datatypes import *
> from decimal import Decimal
> client = Client()
> client.connect('127.0.0.1', 10800)
> cache = client.get_or_create_cache("PY_DECIMAL")
> cache.put(1, Decimal('7.7'), key_hint=IntObject, value_hint=DecimalObject)
> {code}
> JS get
> {code}
> IgniteClient = require('apache-ignite-client');
> IgniteClientConfiguration = IgniteClient.IgniteClientConfiguration;
> const ObjectType = IgniteClient.ObjectType;
> ENDPOINT = '127.0.0.1:10800';
> igniteClient = new IgniteClient();
> async function start() {
>     await igniteClient.connect(new IgniteClientConfiguration(ENDPOINT));
>     try {
>         cache = (await igniteClient.getOrCreateCache("PY_DECIMAL"))
>                     .setKeyType(ObjectType.PRIMITIVE_TYPE.INTEGER);
>         console.log(await cache.get(1));
>     } finally {
>         igniteClient.disconnect();
>     }
> }
> start();
> {code}
> JS return '141350' value
> PHP have same behavior as JS



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)