You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Dmitry Melnichuk (Jira)" <ji...@apache.org> on 2020/05/02 06:37:00 UTC

[jira] [Commented] (IGNITE-12809) Python client returns fields in wrong order since the 2 row when fields_count>10

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

Dmitry Melnichuk commented on IGNITE-12809:
-------------------------------------------

[~ezhuravl], you are totally correct in pinpointing the problematic code. However, you can't just remove the {{sorted()}} function. The {{result}} is of type {{dict}}, not {{OrderedDict}}. These types are essentially the same since Python 3.6, but the code must be compatible with Python 3.4. In 3.4 the {{dict}} object is not retaining the order of its elements, so no sorting will lead to more random ordering problems. Instead, the correct sorting should be applied.

Here I attached a diff file, that contains a fix for this problem, alone with a [^IGNITE-12809_Fix_and_test_value_ordering_for_client_sql.patch]  corresponding test case. [~isapego] could you please look it up.

> Python client returns fields in wrong order since the 2 row when fields_count>10
> --------------------------------------------------------------------------------
>
>                 Key: IGNITE-12809
>                 URL: https://issues.apache.org/jira/browse/IGNITE-12809
>             Project: Ignite
>          Issue Type: Bug
>          Components: platforms
>    Affects Versions: 2.8
>            Reporter: Evgenii Zhuravlev
>            Assignee: Igor Sapego
>            Priority: Major
>              Labels: python
>         Attachments: IGNITE-12809_Fix_and_test_value_ordering_for_client_sql.patch, reproducer.py
>
>
> Reproducer attached. 
> If result set is bigger than a page size(1 by default) and there are more than 10 fields in an object, then, for all rows after the first query column order will be wrong. Looks like column order is being sorted as a string instead of number.
> The reason for that is a sorting in api/sql.py: https://github.com/apache/ignite/blob/master/modules/platforms/python/pyignite/api/sql.py#L445
> If you remove it, everything will work fine. We need to make sure that this is the right solution for this issue.
> Output from reproducer:
> {code:java}
> ['CODE', 'NAME', 'CONTINENT', 'REGION', 'SURFACEAREA', 'INDEPYEAR', 'POPULATION', 'LIFEEXPECTANCY', 'GNP', 'GNPOLD', 'LOCALNAME', 'GOVERNMENTFORM', 'HEADOFSTATE', 'CAPITAL', 'CODE2']
> ['CHN', 'China', 'Asia', 'Eastern Asia', Decimal('9.5729E+6'), -1523, 1277558000, Decimal('71.4'), Decimal('982268'), Decimal('917719'), 'Zhongquo', 'PeoplesRepublic', 'Jiang Zemin', 1891, 'CN']
> ['IND', 'India', 'Bharat/India', 'Federal Republic', 'Kocheril Raman Narayanan', 1109, 'IN', 'Asia', 'Southern and Central Asia', Decimal('3287263'), 1947, 1013662000, Decimal('62.5'), Decimal('447114'), Decimal('430572')]
> ['USA', 'United States', 'United States', 'Federal Republic', 'George W. Bush', 3813, 'US', 'North America', 'North America', Decimal('9.36352E+6'), 1776, 278357000, Decimal('77.1'), Decimal('8.5107E+6'), Decimal('8.1109E+6')]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)