brimdata / zed

A novel data lake based on super-structured data
https://zed.brimdata.io/
BSD 3-Clause "New" or "Revised" License
1.34k stars 67 forks source link

zq option to specify a null input value #5116

Open philrz opened 2 months ago

philrz commented 2 months ago

At the time this issue is being filed, Zed is at commit 6fcbee6.

Currently the zq usage docs explain:

In the case of a yield with no inputs, the query is run with a single input value of null. This provides a convenient means to run in a "calculator mode" where input is produced by the yield and can be operated upon by the Zed query, e.g.,

zq -z '1+1'

emits

2

However, issues like #5110 from the community indicate there's some potential ambiguity about when zq requires arguments, and this "calculator mode" exception is one such example that might create user confusion. During a recent group discussion, there was consensus that we could reduce some ambiguity by requiring the use of a new command line option to explicitly request the "null input". This would closely follow what many users know from jq:

$ jq --help
...
Command options:
  -n, --null-input          use `null` as the single input value;