zed icon indicating copy to clipboard operation
zed copied to clipboard

Post-merge operator prevents debug on flowgraph branches

Open philrz opened this issue 1 year ago • 0 comments

Repro is with Zed commit e7623c5.

This works as expected:

$ zq -version
Version: v1.17.0-27-ge7623c57

$ echo "1 3" | zq 'fork (
  => count() | debug f"debug: count {this}" | yield f"post debug count {this}"
  => sum(this) | debug f"sum is {this}" | yield f"post debug sum {this}"
)' -
"post debug count 2(uint64)"
"post debug sum 4"
"sum is 4"
"debug: count 2(uint64)"

But once I add an operator after the merge point, it no longer parses.

$ echo "1 3" | zq 'fork (
  => count() | debug f"debug: count {this}" | yield f"post debug count {this}"
  => sum(this) | debug f"sum is {this}" | yield f"post debug sum {this}"
) | yield this + " (merged)"' -
output operator must be at flowgraph leaf at line 2, column 16:
  => count() | debug f"debug: count {this}" | yield f"post debug count {this}"
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
output operator must be at flowgraph leaf at line 3, column 18:
  => sum(this) | debug f"sum is {this}" | yield f"post debug sum {this}"
                 ~~~~~~~~~~~~~~~~~~~~~~

This poses a challenge for allowing debug in Zui since the app appends additional operators head after the user's program to help with pagination.

philrz avatar Aug 17 '24 19:08 philrz