Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Values are not sorted properly #4005

Closed
poonai opened this issue Sep 17, 2019 · 4 comments · Fixed by #4260 or #4316
Closed

Values are not sorted properly #4005

poonai opened this issue Sep 17, 2019 · 4 comments · Fixed by #4260 or #4316
Assignees
Labels
area/querylang Issues related to the query language specification and implementation. kind/bug Something is broken. priority/P0 Critical issue that requires immediate attention. status/accepted We accept to investigate/work on it.
Milestone

Comments

@poonai
Copy link
Contributor

poonai commented Sep 17, 2019

What version of Dgraph are you using?

master

Have you tried reproducing the issue with the latest release?

Yes

What is the hardware spec (RAM, OS)?

Steps to reproduce the issue (command/config used to run Dgraph).

Just populate cluster with this data
̍https://github.com/dgraph-io/dgraph/blob/master/query/common_test.go#L269
and run the this query

{
		q(func:has(name), orderdesc: name, first:5) {
			 name
		 }
	 }

Expected behaviour and actual result.

actual result

{
  "data": {
    "q": [
      {
        "name": ""
      },
      {
        "name": ""
      },
      {
        "name": "Badger"
      },
      {
        "name": "name"
      },
      {
        "name": "expand"
      }
    ]
  },
  "extensions": {
    "server_latency": {
      "parsing_ns": 14640,
      "processing_ns": 375499571,
      "encoding_ns": 28760,
      "assign_timestamp_ns": 503321
    },
    "txn": {
      "start_ts": 98
    }
  }
}

Expected everything to be sorted

@campoy campoy added area/querylang Issues related to the query language specification and implementation. kind/bug Something is broken. status/accepted We accept to investigate/work on it. priority/P0 Critical issue that requires immediate attention. labels Sep 17, 2019
@campoy campoy added this to the Dgraph v1.1.1 milestone Sep 17, 2019
@akamos
Copy link

akamos commented Oct 7, 2019

Hi!

I have a similar behaviour at Dgraph 1.1.0. I have data that contains values for name@de and name@ru predicates.
If I try to order these name string predicates with a language tag (orderasc:name@ru) I get different results from each time (its not determined behaviour). Sometimes its sorted correctly, by "ru", and sometimes not! If its not correctly sorted, it's sorted by name@de.

Check it out with following data and queries. Simply query, and the results differ from time to time.
The name and category_type predicates are indexed in schema.

Sample data:

{
  set {
    _:1 <name@de> "Hello World" .
    _:1 <name@ru> "Привет!" . 
    _:1 <category_type> "Test" .

    _:2 <name@de> "ZZZ A little test" .
    _:2 <name@ru> "Авиякомпания" .
    _:2 <category_type> "Test" .

    _:3 <name@de> "Xylophon" .
    _:3 <name@ru> "Книга" .
    _:3 <category_type> "Test" .
	}
}

My query:

{
  q(func:eq(category_type, "Test"),orderasc:name@ru)  {
    name@ru
    name@de
  }
}

@lgalatin lgalatin assigned arijitAD and unassigned poonai Oct 15, 2019
@akamos
Copy link

akamos commented Nov 27, 2019

Are there any updates to this issue? It's for me a critical point in my production system and I would continue to use Dgraph.

@arijitAD
Copy link

There are two PRs related to this issue. One is merged and other one is under review. I have linked both of them to this issue.

@akamos
Copy link

akamos commented Nov 27, 2019

There are two PRs related to this issue. One is merged and other one is under review. I have linked both of them to this issue.

Thanks for the linked PR's!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/querylang Issues related to the query language specification and implementation. kind/bug Something is broken. priority/P0 Critical issue that requires immediate attention. status/accepted We accept to investigate/work on it.
4 participants