-
Notifications
You must be signed in to change notification settings - Fork 67
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
Something like jq's "debug" #5181
Comments
In a recent chat @mccanne refreshed me on his last design thoughts on this topic. We have this concept of "output channels" which are currently numbered but we they should probably be named since that would allow a |
This commit introduces the debug operator- an operator intending to help debugging complex queries. When running the debug operator using zq or zed all encounterd values at the point of the operator are written to stderr. Closes #5181
This commit introduces the debug operator- an operator intending to help debugging complex queries. When running the debug operator using zq or zed all encounterd values at the point of the operator are written to stderr. Closes #5181
This commit introduces the debug operator- an operator intending to help debugging complex queries. When running the debug operator using zq or zed all encounterd values at the point of the operator are written to stderr. Closes #5181
This commit introduces the debug operator- an operator intending to help debugging complex queries. When running the debug operator using zq or zed all encounterd values at the point of the operator are written to stderr. Closes #5181
This commit introduces the debug operator- an operator intending to help debugging complex queries. When running the debug operator using zq or zed all encounterd values at the point of the operator are written to stderr. Closes #5181
This commit introduces the debug operator- an operator intending to help debugging complex queries. When running the debug operator using zq or zed all encounterd values at the point of the operator are written to stderr. Closes #5181
This commit introduces the debug operator- an operator intending to help debugging complex queries. When running the debug operator using zq or zed all encounterd values at the point of the operator are written to stderr. Closes #5181
This commit introduces the debug operator- an operator intending to help debugging complex queries. When running the debug operator using zq or zed all encounterd values at the point of the operator are written to stderr. Closes #5181
This commit introduces the debug operator- an operator intending to help debugging complex queries. When running the debug operator using zq or zed all encounterd values at the point of the operator are written to stderr. Closes #5181
This commit introduces the debug operator- an operator intending to help debugging complex queries. When running the debug operator using zq or zed all encounterd values at the point of the operator are written to stderr. Closes #5181
Verified in Zed commit 97e0d9c. Revisiting the
Another approach would be to invoke
However, this second example reveals a subtlety of the Zed implementation: If invoked multiple times within the same program like this, the relative order of the
I've opened #5225 to disclose this in the docs. For now, Thanks @mattnibs! |
tl;dr
In a recent community Slack thread, a user asked of
zq
:Zed doesn't currently have a 1-to-1 equivalent to this, but a lot of the building blocks are there. To benefit users that come to Zed from tools like
jq
, it does seem like a worthwhile exercise to consider what it might take to provide something similar and rationalize where we think it's appropriate to take a different approach.Details
At the time this issue is being filed, Zed is at commit 6e61673.
The
jq
docs don't actually show an example of their most simpledebug
usage with no parameters, but we can trim their more advanced example to:Here's something similar in
zq
.jq
takes the approach of sending the error outputs to stderr, which means there's ways at the shell to redirect or filter them out.zq
doesn't currently take this approach, which is why I chose to wrap the debug messages in Zederror
values since there's filtering available within the language itself, e.g., making the following the equivalent of tacking2> /dev/null
onto the end of thejq
command line above.Of course, this begs the question of whether this close coupling between the tool and the shell is ideal. A proficient
jq
user that later comes tozq
might indeed have the muscle memory that would make this seem appealing. However, even if this were enabled specifically withzq
to benefit those shell-centricjq
-like users, what would happen in other places where the Zed language can be used? For instance, over the Zed lake API there's no concept of "stderr", so where would the debug output go in that case? In an API-dependent app like Zui, we could perhaps imagine some likely UI, e.g., perhaps a separate window or panel could separate the debug output from query output, or perhaps it could be interleaved with the query output in a way that makes stand out visually and easy to filter. So this would all require design insight.Moving on to the more advanced example as it appears in the
jq
docs:I have what I believe would be a working enhancement that once again approximates what
jq
is doing, taking the approach of passing the multiple "message" parameters as elements of an array. However, I hit what appears to be a bug #5180.I'll plan to pick up this effort once that's addressed.
The text was updated successfully, but these errors were encountered: