we are doing some fancy math that ends up having some values dividing by zero. This will produce a NaN value in some of the fields of the response. If we try to then sort those values, it will not correctly sort.

Can you describe a bit more your problem? Was the data totally unordered, just the rows with NaN values, or the NaN rows were ordered but not the one you expected?

Are you also using a specific source too? (RDBMS? Parquet?)

For ascending order I get :

NaN

NaN

103.55

NaN

100.61515151515154

118.68855345911949

122.04377777777778

For DESC:

122.04377777777778

118.68855345911949

100.61515151515154

NaN

103.55

NaN

NaN

I am using an RDBMS Source. This query is also accelerated by reflection.