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

Zui's ZSON-like output drops union decorators #3151

Open
philrz opened this issue Sep 4, 2024 · 0 comments
Open

Zui's ZSON-like output drops union decorators #3151

philrz opened this issue Sep 4, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@philrz
Copy link
Contributor

philrz commented Sep 4, 2024

tl;dr

Zui's ZSON-like output often leaves out some/all union type decorators. The user should have some way to make sure this is included when they want to see it.

Details

Repro is with Zui commit b426158.

Consider the following ZSON input data that has union types:

$ zq -z union-uint64.zson 
1(uint64)((uint64,float64,string))
"hello"((uint64,float64,string))
3.14((uint64,float64,string))

$ zq -z union-int64.zson 
1((int64,float64,string))
"hello"((int64,float64,string))
3.14((int64,float64,string))

As shown in the attached video, the union-uint64.zson data is output with one value containing a partial type decorator that cannot be read back in as ZSON. Meanwhile the union-int64.zson data is output with the type decorators left off entirely, such that if read back as ZSON the history of the union type is lost completely.

Repro.mp4

I discussed this one with @mccanne and he was sympathetic to the fact that the type decorators often can make output more difficult to interpret, particularly when they get long. However, one of the strengths of ZSON is that it's in no way "lossy".

Per #2880, I've heard rough consensus that it's good that Zui's Inspector output is very close to ZSON, though things like the numeric array prefixes (0:, 1:, ...) and "..." to truncate long values to fit into the display are reasonable compromises since they are intuitive and can be divulged to users in the docs. Along similar lines, it seems there should be a way to make sure the user is aware when union types are present, even if the decorators are not always printed out in full.

When discussing this with @mccanne, he proposed showing "(...)" as a visual cue that there's a type decorator present and allowing the user to click on it to expand it. I'm a fan of this also. Perhaps some control to "expand/collapse all type decorators" would also be helpful if the user wants to see a lot of this detail at once without having to do lots of clicking.

@philrz philrz added the bug Something isn't working label Sep 4, 2024
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

1 participant