brimdata / super

A novel data lake based on super-structured data
https://zed.brimdata.io/
BSD 3-Clause "New" or "Revised" License
1.39k stars 64 forks source link

Cleaner `zar zq` output on stdout with text formats #759

Closed henridf closed 4 years ago

henridf commented 4 years ago

The zar README brings the reader to this zar zq query:

$ zar zq "count()" _ | zq -f table -
COUNT
222617
223815
218575
...

at which point, one might recall that zar zq supportsd different output formats, and directly try:

$ zar zq -f table "count()" _ 
COUNT
222617
COUNT
223815
COUNT
218575
...

which gives correct results, but with extra headers that are a little surprising. This is not a bug, but would likely be unexpected to someone without deep familiarity with the inner workings of zq and zar (as a README reader might be).

This can be addressed as suggested by @mccanne:

A fix could be for stdout to merge the zng sub-streams that are created during the walk into one type context and have a single writer instance for stdout.

philrz commented 4 years ago

Verified in zq commit 97f6edf.

Per linked PR #818, the originally cited issue has been addressed by removing the -f option such that the user would need to use a post-pipe zq to perform alternate formatting.