orientechnologies / pyorient

OrientDB driver for Python that uses the binary protocol.
Apache License 2.0
119 stars 38 forks source link

SELECT DISTINCT ignores the first field specified #31

Open Penniman opened 5 years ago

Penniman commented 5 years ago

Execute a query such as:

SELECT DISTINCT userid, book_title, isbn FROM book_views

Will return an oRecordData object with fields for book_title and isbn but there will be no userid included. The same query executed in OrientDB Studio executes correctly and returns all fields.

My workaround has been to include a bogus field name:

SELECT DISTINCT pyorient_select_distinct_bug_workaround, userid, book_title, isbn FROM book_views

This is with OrientDB 3.0.15, PyOrient 1.5.5, and python 3.7.2.

civanescu commented 2 years ago

I have the same issue, BUT.... the results are different.... I believe it is using the old command (because of language). For example when I do query with no DISTINCT query in OrientDb I have 43958, with DISTINCT I get 8758 records. In Python without DISTINCT I receive 43958, with DISTINCT fake_column I also receive 43958. I believe is that the language used is not compatible with 3.0 ... check this new feature: https://www.orientdb.org/docs/3.0.x/release/3.0/SQL-Changes.html#distinct-keyword