zq
version 1.16.0 and jq version 1.7jq
(not to mention “operators” in jq
docs refer to things like +
and -
, and zq
“dataflow operators” are things like over
, yield
, and put
).zq
always need to be called with parentheses, even if it has no arguments (like the now
function). But in jq
, argumentless functions receive their input via the pipe |
operator and don't have parens, like Dataflow Operators in zq
.❯ echo "[1,2,3]" | jq 'length'
3
❯ echo "[1,2,3]" | jq 'length()'
jq: error: syntax error, unexpected ')' ... at <top-level>, line 1:
length()
jq: 1 compile error
zq
“thing” is a dataflow operator vs. a function (I generally have to look all those things up anyway with either tool) the rule to keep in mind in zq
is if it's a function, it's gotta have parens.❯ echo '{a:null}' | zq 'now() | {a:this}' -
{a:2024-07-12T14:25:24.70848Z}
search
implied operator. (see ZqImpliedOperator).❯ echo '{a:null}' | zq 'now | {a:this}' -
❯