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

Zed CLI tools won't output ZNG to terminal even if explicitly requested #5245

Open
philrz opened this issue Aug 22, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@philrz
Copy link
Contributor

philrz commented Aug 22, 2024

tl;dr

The following still produces ZSON output despite the -f zng.

$ echo '{ts:2024-08-14T19:12:51Z}' | zq -f zng -
{ts:2024-08-14T19:12:51Z}

Details

Repro is with Zed commit b9388c4.

In the absence of an explicit requested format via -f, the CLI tools are currently clever about sending ZSON by default if terminal output is detected and binary ZNG if the output is redirected. However, we offer the -f option if the user is confident they want to force it. In this regard, they can indeed get binary Parquet gobbledygook at the terminal if it's truly what they seek.

$ zq -version
Version: v1.17.0-36-gb9388c4c

$ echo '{ts:2024-08-14T19:12:51Z}' | zq -f parquet - 
PAR1L>j(??>j(?>j(?>j(?>j(??,5schema%tsl?<&?5ts??&>j(?>j(?>j(?>j(??,??
                                                                     parquet-go version 14.0.0?PAR1

Though it's hard to imagine why it would be desirable, it does seem like we should do the same with -f zng.

@philrz philrz added the bug Something isn't working label Aug 22, 2024
@nwt
Copy link
Member

nwt commented Sep 17, 2024

This is by design. Use the -B flag to send ZNG to standard output when it's connected to a terminal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants