Sorting on multiple predicates broken on 20.11.1

Report a Dgraph Bug

What version of Dgraph are you using?

20.11.1

Have you tried reproducing the issue with the latest release?

Not tried on master.
No bug with 20.11.0.

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

Run a query with a sort on 2 predicates:

{
	word_0(func: lt(pick_proposed, 10), first: 1, orderasc: pick_proposed, orderasc: label) {
		uid
		label
	}
}

Dgraph alpha fails:

github.com/dgraph-io/dgraph/x.AssertTrue
	/ext-go/1/src/github.com/dgraph-io/dgraph/x/error.go:100
github.com/dgraph-io/dgraph/worker.multiSort
	/ext-go/1/src/github.com/dgraph-io/dgraph/worker/sort.go:371
github.com/dgraph-io/dgraph/worker.processSort
	/ext-go/1/src/github.com/dgraph-io/dgraph/worker/sort.go:531
github.com/dgraph-io/dgraph/worker.SortOverNetwork
	/ext-go/1/src/github.com/dgraph-io/dgraph/worker/sort.go:70
github.com/dgraph-io/dgraph/query.(*SubGraph).applyOrderAndPagination
	/ext-go/1/src/github.com/dgraph-io/dgraph/query/query.go:2362
github.com/dgraph-io/dgraph/query.ProcessGraph
	/ext-go/1/src/github.com/dgraph-io/dgraph/query/query.go:2204
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1374

With the following query, there is no bug:

{
	word_0(func: lt(pick_proposed, 10), first: 1, orderasc: pick_proposed) {
		uid
		label
	}
}

Hi @myo,

Can you share schema, especially information about pick_proposed and label predicates ? Are these predicates indexed and if indexed, the tokenizer they are indexed with ?

Hello @rajas,
Here is their schema definition:

label:	 				string			@index(exact) @upsert	.
pick_proposed:	 		int				@index(int)				.

Thanks for providing schema. I am able to reproduce this. I am accepting this as a bug. This will be worked upon in coming weeks.

2 Likes

@myo: This issue is now fixed in Master: fix(sort): Fix multi-sort with nils by ahsanbarkati · Pull Request #7432 · dgraph-io/dgraph · GitHub. Please let us know if you still seeing any issues.

1 Like

I confirm it is fixed with 20.11.2, thx.

2 Likes