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

Add text to debug doc about multiple invocations #5225

Merged
merged 1 commit into from
Aug 16, 2024
Merged

Conversation

philrz
Copy link
Contributor

@philrz philrz commented Aug 16, 2024

What's Changing

Disclosing out-of-order output expectations in the debug operator docs.

Why

When doing final verification of the debug operator, I revisited the recreation of the jq example shown in #5181 and noticed something for the first time in our implementation: Whereas jq's debug outputs always appear in the relative order that matches their appearance in the pipeline:

$ jq -n '1 as $x | 2 | debug("Entering function foo with $x == \($x)", .) | (.+1)'
["DEBUG:","Entering function foo with $x == 1"]
["DEBUG:",2]
3

In our equivalent, the order of the debug outputs can vary. I understand this to be an expected side effect of our implementation, but I also expect this might look like a bug to some users, so I figure a disclosure might help.

$ zq 'const x=1 yield 2 | debug f"DEBUG: Entering function foo with x == {x}" | debug f"DEBUG: {this}" | yield this+1'
3
"DEBUG: 2"
"DEBUG: Entering function foo with x == 1"

$ zq 'const x=1 yield 2 | debug f"DEBUG: Entering function foo with x == {x}" | debug f"DEBUG: {this}" | yield this+1'
3
"DEBUG: Entering function foo with x == 1"
"DEBUG: 2"

@philrz philrz requested a review from a team August 16, 2024 17:25
@philrz philrz self-assigned this Aug 16, 2024
@philrz philrz linked an issue Aug 16, 2024 that may be closed by this pull request
@philrz philrz merged commit 60e2601 into main Aug 16, 2024
4 checks passed
@philrz philrz deleted the multi-debug-doc branch August 16, 2024 18:46
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.

Something like jq's "debug"
2 participants