Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document top operator #5276

Merged
merged 4 commits into from
Sep 16, 2024
Merged

Document top operator #5276

merged 4 commits into from
Sep 16, 2024

Conversation

philrz
Copy link
Contributor

@philrz philrz commented Sep 13, 2024

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 have SELECT TOP, but this is only in limited dialects (e.g., others use LIMIT) and so those are more synonymous with Zed's head 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-like top equivalent by combining it with count().

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 in sort 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.

docs/language/operators/top.md Outdated Show resolved Hide resolved
@philrz philrz requested review from nwt and a team September 16, 2024 22:57
@philrz philrz merged commit 491dadf into main Sep 16, 2024
4 checks passed
@philrz philrz deleted the document-top branch September 16, 2024 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document top operator
3 participants