Skip to content

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

Open
@philrz

Description

@philrz

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions