Dgraph: Values are not sorted properly

Created on 17 Sep 2019  路  4Comments  路  Source: dgraph-io/dgraph

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

arequerylang kinbug prioritP0 statuaccepted

All 4 comments

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
  }
}

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.

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.

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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mbudge picture mbudge  路  3Comments

ShawnMilo picture ShawnMilo  路  4Comments

MichelDiz picture MichelDiz  路  3Comments

xhochipe picture xhochipe  路  3Comments

marvin-hansen picture marvin-hansen  路  4Comments