zed icon indicating copy to clipboard operation
zed copied to clipboard

Examples that rely on additional shell utilities

Open philrz opened this issue 1 year ago • 1 comments

Some examples make use of commands other than just echo and super.

Details

I think the primary example that does this at the moment is this one for the dcount function, which calls on seq to efficiently get enough input values to illustrate when the result can become inaccurate.

https://github.com/brimdata/super/blob/8e86ac0ff4c9da6c278eb0ec9a8efba9f888c9d5/docs/language/aggregates/dcount.md?plain=1#L61-L67

There's also an example in the ZJSON format doc that calls on jq on the output side, since the -f zjson output is compact JSON but it's difficult to read in that form.

https://github.com/brimdata/super/blob/8e86ac0ff4c9da6c278eb0ec9a8efba9f888c9d5/docs/formats/zjson.md?plain=1#L289-L291

I'm not super concerned with that one since ZJSON has mostly internal use at the moment, and that may be the case for a long time.

Ideas

Since there's few examples currently affected by this, leaving them as mdtest-command for now seems totally appropriate.

If we did want to look at an approach for the dcount example that would enable this and possible future similar scenarios, I guess we'd need a way in mdtest-spq to indicate non-echo-style inputs. On the rendering side, it seems this would indicate replacing the Input panel with something that shows the data is instead coming from the alternate, command-based source. I have no idea how feasible it is to do that in the browser context since it sounds like that would imply having a whole Linux-style environment with commands like seq at your disposal.

If we wanted to address just this one specific example, another thought is that we could add a seq or similar operator in the SuperSQL language that originates a stream of values, then have the example use that rather than calling out to the shell. That would seem like overkill to just benefit one docs example, but if other use cases pop up for such a thing, I'll remember it's related to this.

philrz avatar Feb 06 '25 18:02 philrz

#6007 would provide an alternative within super that could be used instead of seq to create the numeric sequence needed to demonstrate dcount.

philrz avatar Aug 13 '25 16:08 philrz