mirror of
https://github.com/tiennm99/litellm.git
synced 2026-07-17 16:17:18 +00:00
The previous version appended NULLS LAST to every ORDER BY, which would silently change DESC semantics for any nullable sort column added to the whitelist later. Today the existing sort columns (spend, total_tokens, startTime, endTime, request_duration_ms, model) are all non-null in the result set, so the clause is a no-op for them — but the broader form is misleading. Apply NULLS LAST only when sorting by ttft_ms (the only column whose computed expression actually produces NULLs). Update the model test to assert the clause is absent for non-nullable columns.