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

Bugs with rendering of named types #2986

Open
philrz opened this issue Jan 22, 2024 · 1 comment
Open

Bugs with rendering of named types #2986

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

Comments

@philrz
Copy link
Contributor

philrz commented Jan 22, 2024

tl;dr

Named types are currently being rendered in Zui with extra parens (e.g., port=(uint16)) but in the Zed tooling this has been simplified to drop those (e.g., port=uint16).

Update: In the time since this issue was first opened, we've spotted some additional bugs with the rendering of named types. See the comment below for details.

Details

Repro is with Zui commit b413f0c.

brimdata/zed#5000 (review) includes a summary of when we changed the ZSON syntax for named types and only recently updated the docs to reflect this. This is another whack-a-mole case such as described in #2880.

The attached video shows the current difference between Zui's presentation and that of the Zed tooling using this input data.zson:

{p1:80 (port=uint16), p2: 8080 (port)}
Repro.mp4

If a user were to cut & paste the current ZSON-like text out of Zui and try to use it as ZSON input data, it would cause an error.

$ zq -version
Version: v1.12.0-41-g9e952f36

$ echo '{ p1: 80 ( port=(uint16)) , p2: 8080 ( port=(uint16)) }' | zq -i zson -
stdio:stdin: parse error: type list not found parsing union type at '('
@philrz philrz added the bug Something isn't working label Jan 22, 2024
@philrz
Copy link
Contributor Author

philrz commented Feb 8, 2024

In the time since this issue was first opened, we've spotted some additional problems with the rendering of named types. The repro below is at Zui commit 67797fd and uses the following input data.zson:

{
    nest1: {
        foo: "bar"
    },
    nest2: {
        foo: "bar"
    } (=AnotherName),
    nest3: {
        foo: "bar"
    }
}

The attached video shows three problems related to the named type in this data:

  1. There's no leading = shown in the type decorator for AnotherName like we see in the ZSON rendering from the CLI tooling. As the ZSON spec describes, the = is necessary when it's defined as a new type but then can be dropped in later references.
  2. In the Columns picker, the nested field foo is not shown for the nested record that's a named type. This symptom was first reported to us by a community zync user.
  3. The named type is described in the Columns picker as an <alias>, but this terminology has been purged from Zed in favor of "named type". In any case, for the purposes of what's shown in the Column picker, I imagine labeling it <record> is probably still appropriate, though it may be worth polling the Zed dev team for input as well.
Repro.mp4

@philrz philrz changed the title Named types are rendered with extra parens Bugs with rendering of named types Feb 8, 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