Text-based files like CSV can be `grep`-ed en masse, which I do often.
eg, to find some value across a ton of files.
Is that possible with parquet?
Text-based files like CSV can be `grep`-ed en masse, which I do often.
eg, to find some value across a ton of files.
Is that possible with parquet?
Obviously text-oriented grep doesn't work. But table oriented duckdb can work very well indeed (and it basically combines a lot of awk and grep together)
$ duckdb <<EOQ
select count(\*) from 'archive.parquet' where sensor = 'wifi'
EOQ
┌──────────────┐
│ count_star() │
│ int64 │
├──────────────┤
│ 4719996 │
└──────────────┘
$
You can change a lot of aspects around such as the output format, but the point remains that you can do grepy things with Parquet files quite easily.Normally `parquet-tools cat` turns it into greppable lines. But chances are high you have pandas, DuckDB, or even Spark installed nearby, if you actually need things like Parquet.
> `parquet-tools cat` turns it into greppable lines
After all, you can't grep gzipped CSV either without some ancilliary tool than grep.
I wonder, do people on the Caterpillar forum have this problem, where people just show up to ask, "Yeah but can you take it on the freeway? Because I can take my Tacoma on the freeway."
Maybe you were being sarcastic, I'm not sure. But I hope it's obvious that advocating for complexity at all is not the same thing as advocating for complexity regardless of need.
I use parquet for small stuff now, because it’s standardised and so much nicer and more reliable to use. It’s faster. It ships a schema. There’s actual data type support. There’s even partitioning support if you need it. It’s quite literally better in every useful way.
Long winded way of saying: the complexity has always been there. CSV’s act as if it’s not there, parquet acknowledges it and gives you the tools to deal with it.
Once you've got the data into a processing pipeline you do need additional semantic structure to not lose integrity, which I think Parquet is fine for, but any SQL schema will also do.
CSV, being row-oriented, makes it much easier to append data than parquet, which is column-oriented.
CSV is also supported by decades of software, much of which either predates parquet or does not yet support parquet.
CSV, being a newline-delimited text-based format, is much better suited for inclusion in a git repository than parquet.
I use parquet wherever I can, but I still reach for csv whenever it makes sense.
CSV can not be supported by any software because it's not really a format. If you don't understand what I am saying by this, please write down an algorithm for figuring out which type of quoting is used in a given CSV file. Also please explain to me how you would deal with new lines in the text data.
End of the day, if the format needs to be used by arbitrary third parties who maybe/probably have no technical experience beyond excel, then CSV is the best option.
If human readable and Excel support are not required, then by all means Parquet is the winner.
TLDR: The best format depends on how you need to use the data.
CSV is a very good demonstration of these problems.
Binary formats tend to be quite a bit more robust, with a much higher average quality of implementation, because they’re harder to work with.
Or rather because parsing human readable text comes with many edge cases, than encoding stuff into binary.
```bash
parquet2json cat <file or url> | grep ...
```
But the whole point of parquet is doing things at scale in clusters, not doing some one of quick and dirty processing on tiny data on a laptop. You could do it. But grep and csv work well enough for those use cases. The other way around is a lot less practical.
On the other hand if grepping is fast, parquet doesn't really make sense in that scenario. You're better off with a structured format like JSON or XML if grep finishes in less than a few minutes.
That said, if you are using parquet, I think it is safe to assume large data sets. Large structured data sets, specifically. As such, getting a one liner that can hit them with a script is doable, but you probably won't see it done much due to utility.