Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's Changing
Docs are added for the
top
operator.Why
It's been undocumented for a long time, primarily due to resistance from me, but I am now officially reversing my position. 😂
Details
#4590 (comment) summarizes my prior resistance, the tl;dr being that tools like Splunk and Humio (now LogScale) each have their own
top
that had different functionality, and log-centric use cases were a big enough focus of the Zed tools that I was concerned this would create confusion. However, the more recent focus has been on applying Zed in general data use cases, and in that world I see less room for confusion, e.g., some SQL implementations haveSELECT TOP
, but this is only in limited dialects (e.g., others useLIMIT
) and so those are more synonymous with Zed'shead
operator. In conclusion, it seems the word is kinda used all over the place and I'm now recognizing the futility of my holding out this long hoping it would become clearer.In this PR I've revived an old branch from @mattnibs where he started drafting the
top
docs in #5066. In addition to general polish, I also added an additional example that happens to show how to achieve the Splunk-liketop
equivalent by combining it withcount()
.The astute reader may notice that the comparison with
sort
I've left in the text is perhaps now dated because #5203 gave us per-key ordering insort
and, as called out in #4591,top
lacks that. Personally, I'm fine with that distinction remaining until users speak up or we have spare cycles.Closes #4590.