zed icon indicating copy to clipboard operation
zed copied to clipboard

Examples with output other than compact SUP

Open philrz opened this issue 1 year ago • 0 comments

At the moment, mdtest-spq examples all expect compact SUP output, but several examples would be much more readable with alternate formats.

Details

There's several examples of this, but the Shaping doc has a bunch together, such as this one that shows the cast function:

Image

As you can see, the multi-field record in the Result area is large enough that it would require the user to "scroll right" to see its full contents, which is something we like to spare the readers when possible (we had complaints about this in the old docs site that led me to reformat a bunch of mdtest-command examples into \-separated multiple lines back in the day). Also, the compact nature of the SUP makes it somewhat difficult to quickly spot the different fields.

By comparison, the output was formatted with -Z in the old docs site, making it more readable:

Image

When converting issues in #5489, I made a judgement call as to whether to leave these as mdtest-command just to have the benefit of the -Z formatting or switch to mdtest-spq to get the better presentation and interactivity at the cost of imperfect output, and in most cases I chose the latter. But it would be great if we could have it both ways and support alternate output formats in mdtest-spq and have the Playground rendering react to that and present them similarly.

While almost all such examples just need -Z, there's a couple others that benefit from other formats, such as this fuse example I left as mdtest-command for this reason:

https://github.com/brimdata/super/blob/8e86ac0ff4c9da6c278eb0ec9a8efba9f888c9d5/docs/language/operators/fuse.md?plain=1#L83-L92

Or the Zeek integration docs:

https://github.com/brimdata/super/blob/8e86ac0ff4c9da6c278eb0ec9a8efba9f888c9d5/docs/integrations/zeek/data-type-compatibility.md?plain=1#L257-L271

Ideas

The formats like table and zeek may not be long for this earth, so if for some reason it was much easier to only support -Z and require all other alt format examples to still use mdtest-command, that compromise might be reasonable. However, since we might have reason to show other alt text formats in future examples (csv, line, etc.) it might be good to future-proof by having something flexible that allowed the mdtest-spq example to invoke any supported format. Of course the Playground renderer would need to respond to that not only to show the Result panel in that format but also to include the matching -f option in what appears in the "CLI" tab.

philrz avatar Feb 06 '25 18:02 philrz