| 1 |
Non-zarr uses |
| 2 |
============= |
| 3 |
|
| 4 |
The majority of this documentation focuses on reading arrays via ``zarr``. However, |
| 5 |
there are other applications where accessing files in a particular directory structure |
| 6 |
or reading binary pieces of large files at known offsets is very useful. Here descriptions |
| 7 |
of some use cases, yet to be developed. |
| 8 |
|
| 9 |
.tar.zstd |
| 10 |
--------- |
| 11 |
|
| 12 |
Often, files are stored for archival by first concatenating and then compressing them. |
| 13 |
This is done to save space and data transfer upon access. However, it makes direct |
| 14 |
access of the contents hard, and often means that access can only happen by downloading |
| 15 |
whole files and unpacking them locally. |
| 16 |
|
| 17 |
The TAR format is simple enough to be able to index at which offsets which files start, |
| 18 |
and Zstd is a modern enough compressor that it can be read block-wise, so it should |
| 19 |
be possible to get the best of both worlds: to only pull the parts of the data that |
| 20 |
are actually needed (in parallel!), but still achieve good compression for long-term |
| 21 |
cost saving. |
| 22 |
|
| 23 |
.csv/.json |
| 24 |
---------- |
| 25 |
|
| 26 |
Binary formats are much more efficient at data storage, both in terms of space and |
| 27 |
performance. However, a whole lot of data is still sored in text formats like CSV, JSON |
| 28 |
and others. For these two, subsequent rows are indicated by a terminating newline character, |
| 29 |
which means that parallel/random access is possible by searching for them. |
| 30 |
|
| 31 |
However, both formats allow for newline characters that are *not* record terminators, |
| 32 |
because they can be included in quoted strings. In this case, if reading from some |
| 33 |
random offset in the file, it's not possible to know whether a given newline is indeed |
| 34 |
a record terminator, and any misidentification will lead to parsing failure. |
| 35 |
|
| 36 |
If we can scan the file just once, we can determine where the rows end, and which offsets |
| 37 |
are safe to use, allowing parallel/distributed processing of files with embedded |
| 38 |
newlines. |
| 39 |
|
| 40 |
parquet/orc/feather |
| 41 |
------------------- |
| 42 |
|
| 43 |
Parquet is an efficient tabular data format. Sometimes, however, it is useful to |
| 44 |
*partition* the data on low-cardinality rows, so save on storage and make it easier |
| 45 |
to exclude unneeded files from processing. For instance, if one file in a dataset |
| 46 |
has the name "month=may/part.001.parquet", then all the values of the column "month" |
| 47 |
are "may: for this part of the dataset, and there is no need to store the column |
| 48 |
values. |
| 49 |
|
| 50 |
Since we have the ability to name files as we wish in a virtual file system, we can |
| 51 |
use this feature of parquet to be able to assign values to partitions even when the |
| 52 |
files were not written as part of the same dataset. We can, in effect, perform smart |
| 53 |
concatenation without having to move/copy files around. |
| 54 |
|
| 55 |
Feather is a more raw buffer-wise serialisation of Arrow data, and we may be able to |
| 56 |
construct logical feather files out of buffer pieces (and serialised feather metadata) |
| 57 |
to present to the pyarrow API. |
| 58 |
|
| 59 |
.. raw:: html |
| 60 |
|
| 61 |
<script data-goatcounter="https://kerchunk.goatcounter.com/count" |
| 62 |
async src="//gc.zgo.at/count.js"></script> |