Live data from Hacker News

Zq: An easier and faster alternative to jq

brimdata.io

1–10 of 237 posts

Re: Zq: An easier and faster alternative to jq

#2
It takes a while to get to the point so I’ll save others some time and tldr this very lengthy and agenda-driven blog post:

jq had a tough learning curve so you should switch to zq which is a (closed source?) wrapper around an obscure language you’ve never heard of that we promise is easier because reasons. Also coincidentally it’s the language of an ecosystem we were funded to build.

Edit: mea culpa, turns out you can download the source (revealed half way through the article).

Re: Zq: An easier and faster alternative to jq

#4
post #2

It takes a while to get to the point so I’ll save others some time and tldr this very lengthy and agenda-driven blog post: jq had a tough learning curve so you should switch to zq which is a (closed source?) wrapper around an obscure language you’ve never heard of that we promise is easier because reasons. Also coincidentally it’s the language of an ecosystem we were funded to build. Edit: mea culpa, turns out you ca…

Closed source? https://github.com/brimdata/zed/blob/main/runtime/query.go

Yes, it’s an obscure query language. But if you were interested in jq, that clearly wasn’t a barrier to entry.

I agree the author is happy to show off their tool, but disagree that that is somehow disqualifying. They made a cool thing, they’re allowed to be proud about it.

Re: Zq: An easier and faster alternative to jq

#5
The name of its corporate progenitor may leave a bad taste in some mouths, but I highly recommend PowerShell for this sort of thing. It's cross platform, MIT licensed, and comes with excellent JSON parsing and querying capabilities. Reading, parsing, and querying JSON to return all red cars:

  Get-Content cars.json | ConvertFrom-Json | ? { $_.color -eq 'red' }
The beauty of this is that the query syntax applies not just to JSON but to every type of collection, so you don't have to learn a specific syntax for JSON and another for another data type. You can use Get-Process on Linux to get running processes and filter them in the same way. The same for files, HTML tags, etc. I think nushell is doing something similar, though I haven't tried it yet.

I prefer this approach to another domain-specific language, as interesting as jq's and zq's are.

Re: Zq: An easier and faster alternative to jq

#6
Since no one seems to know about it, jq is described in great detail on the github wiki page [0]. That flattens the learning curve a lot. It's not as arcane as it seems.

The touted claim that is fundamentally stateless is not true. jq is also stateful in the sense that it has variables. If you want, you can write regular procedural code this way. Some examples [1]

The real problem of jq is that it is currently lacking a maintainer to assess a number of PRs that have accumulated since 2018.

[0] https://github.com/stedolan/jq/wiki/jq-Language-Description

[1] https://github.com/fadado/JBOL/blob/master/fadado.github.io/...

Re: Zq: An easier and faster alternative to jq

#7
post #3

I don't get it. "Instead of learning jq DSL, learn zq DSL". To me they look similarly complicated and the examples stresses certain aggregation operations that are harder to do in jq (due to it being stateless).

> "Instead of learning jq DSL, learn zq DSL"

I think you got it — that’s exactly the idea. They claim (reasonably?) that it’s a more intuitive DSL; and it supports state. They also make some performance claims towards the end of the article.

Re: Zq: An easier and faster alternative to jq

#9
post #2

It takes a while to get to the point so I’ll save others some time and tldr this very lengthy and agenda-driven blog post: jq had a tough learning curve so you should switch to zq which is a (closed source?) wrapper around an obscure language you’ve never heard of that we promise is easier because reasons. Also coincidentally it’s the language of an ecosystem we were funded to build. Edit: mea culpa, turns out you ca…

[deleted]

Re: Zq: An easier and faster alternative to jq

#10
If jq is getting too slow for you (that's never happened for me), it really seems like it's time to put your data in a database like sqlite or duckdb at least.

Incidentally there are many tools that help you do this like dsq [0] (which I develop), q [1], textql [2], etc.

[0] https://github.com/multiprocessio/dsq

[1] https://github.com/harelba/q

[2] https://github.com/dinedal/textql

Post reply on HN