malloydata / malloy

Malloy is an experimental language for describing data relationships and transformations.
http://www.malloydata.dev
MIT License
1.96k stars 76 forks source link

NULLS LAST/FIRST #517

Open lloydtabb opened 2 years ago

lloydtabb commented 2 years ago

Malloy should have an attitude about NULL and sorting. I'm thinking NULLS LAST is what we generally want. You can always COALESE to a low value if you want to sort them first.

Discussion?

greg-finley commented 2 years ago

A quick survey of various languages:

By default: nulls first when ascending, nulls last when descending:

By default: nulls last when ascending, nulls first when descending:

Three of the four let you throw in a NULLS FIRST or NULLS LAST, though MySQL has this weird minus syntax.

greg-finley commented 2 years ago

In general I agree with the sentiment that nulls are the least important generally and could always be last, but it's weird to diverge from seemingly every language that by default orders them to the top in one of its sort orders.

If the column is high cardinality, it's possible you'd never notice the nulls at all if you have a record limit.