News for hackers. Stuff that matters.
Re:Apache Arrow 3.0 by nomel on Wednesday February 03, 2021 @06:31PM (#26020657)
Until arrow has proper support for multidimensional arrays [1], its not really appropriate for many use cases.

Not having first class support for multidimensional arrays, in a modern framework, really surprised me and my sensor data.

[1] https://lists.apache.org/x/thread.html/9b142c1709aa37dc35f1c...

Re:Apache Arrow 3.0 by lmeyerov on Wednesday February 03, 2021 @07:09PM (#26020965)
FWIW, you can support tensors etc. natively today by using Arrow's structs, such as `column i_am_packed: {x: int32, y: int32, z: int32, time: datetime64[ns], temp: int32}`. This will be a dense, packed representation for whatever fixed type the column has, including dynamically generated. It ends up being quite nice to have that passed around, esp. vs say protobufs.

You wouldn't be sending mixed-length values, and ~all metrics systems I've worked with would be fine there. The nullables end up a win for those. However, you'd need to do a manual (likely zero-copy) casts between the struct-type to whatever tensor-type you're using. Massively popular ml systems like huggingface do this fine afaict for their Arrow-based tensor work. Likewise, as we do a lot of GPU stuff, what's additionally common is compacting the in-memory stuff as big memory blocks ('long recordbatches') instead of CPU-land's typically more fragmented ones, and that ends up making casts even easier. Annoying to have to add an explicit cast for some interop cases, but preserves end-to-end type safety & hasn't been a deal breaker for us. Having to write the cast being annoying/difficult, esp. for whoever does it first.

More frustrating for us has been sparse data and compression controls, but most formats are even worse here..

Re:Apache Arrow 3.0 by wesm on Wednesday February 03, 2021 @07:23PM (#26021076)
Almost no database systems support multidimensional arrays. So they are not appropriate for many use cases?

* BigQuery: no * Redshift: no * Spark SQL: no * Snowflake: no * Clickhouse: no * Dremio: no * Impala: no * Presto: no ... list continues

We've invited developers to add the extension types for tensor data, but no one has contributed them yet. I'm not seeing a lot of tabular data with embedded tensors out in the wild.

Re:Apache Arrow 3.0 by aldanor on Wednesday February 03, 2021 @10:09PM (#26022146)
I think that implementing good ndim=2 support would already be a huge leap forward, it doesn't have to be something super generic. E.g., given that most of the classic machine learning is essentially using 2-dimensional data (samples x features) as inputs, this is a very common use case.

E.g., as of right now, having to concatenate hundreds of columns manually just in order to pass them to some ml library in a contiguous format is always a pain and often doubles the max ram requirement.

Re:Apache Arrow 3.0 by lmeyerov on Thursday February 04, 2021 @06:24PM (#26030994)
This may help you do zero copy for a column of multi-dim without losing value types, just that it's encoding a multi-dim. This example is for values that are 3x3 of int8's:

```

import pyarrow as pa

my_col_of_3x3s = pa.struct([ (f'f_{x}_{y}', pa.int8()) for x in range(3) for y in range(3) ])

```

If using ndarrays, I think our helpers are another ~4 lines each. Interop with C is even easier, just cast. You can now pass this data through any Arrow-compatible compute stack / DB and not lose the value types. We do this for streaming into webgl's packed formats, for example.

What you don't get is a hint to the downstream systems that it is multidimensional. Tableau would just let you do individual bar charts, not say a heatmap, assuming they support rank 2's. To convert, you'd need to do that zero-copy cast to whatever they do support. I agree a targetable standard would avoid the need for that manual conversion, and increases the likelihood they use the same data rep.

Native support would also avoid some header bloat from using structs. However, we find that's fine in practice, it's metadata. E.g., our streaming code reads the schema at the beginning and then passes it along, so actual payloads are pure data, and skip resending metadata.

Re:Apache Arrow 3.0 by ahachete on Thursday February 04, 2021 @04:11AM (#26023933)
Re:Apache Arrow 3.0 by mkl on Wednesday February 03, 2021 @07:49PM (#26021239)
If you out a blank line between your bullet points, they'll display properly:

* BigQuery: no

* Redshift: no

* Spark SQL: no

* Snowflake: no

* Clickhouse: no

* Dremio: no

* Impala: no

* Presto: no

Re:Apache Arrow 3.0 by jhgb on Thursday February 04, 2021 @07:06AM (#26024658)
I suspect that AllegroCache accepts arrays with rank>=2, although I never got around to trying it out. (At the very least its documentation has nothing to say about any limitations on what kinds of arrays can be stored, so I'm assuming it stores all of them.)
Re:Apache Arrow 3.0 by est on Wednesday February 03, 2021 @10:11PM (#26022161)
On a side note, Clickhouse had some Arrow support

https://github.com/ClickHouse/ClickHouse/issues/12284

Re:Apache Arrow 3.0 by zX41ZdbW on Thursday February 04, 2021 @04:54AM (#26024119)
ClickHouse has support for multidimensional arrays.
Re:Apache Arrow 3.0 by wenc on Wednesday February 03, 2021 @08:01PM (#26021326)
The only database I know of that natively supports multidimensional arrays is SciDB (one of Stonebraker's products)

https://en.wikipedia.org/wiki/SciDB

Re:Apache Arrow 3.0 by Shelnutt2 on Wednesday February 03, 2021 @10:13PM (#26022168)
TileDB[1] supports both sparse and dense multidimensional arrays. We support returning data in arrow arrays or an arrow table as one of many ways we interoperate with computational tools. You can also access the data directly via numpy array, pandas, R data.frames and a number of integrations with MariaDB, Presto, Spark, GDAL, PDAL and more.

Disclaimer: I am a member of the TileDB team.

[1] https://tiledb.com/

Re:Apache Arrow 3.0 by zX41ZdbW on Thursday February 04, 2021 @04:57AM (#26024128)
ClickHouse has support for multidimensional arrays with arbitrary types and number of dimensions.

They are stored in tables in efficient column-oriented format.

Re:Apache Arrow 3.0 by hodgesrm on Wednesday February 03, 2021 @11:11PM (#26022481)
What are the use cases where multi-dimensional arrays are important and why?
Re:Apache Arrow 3.0 by phillc73 on Thursday February 04, 2021 @04:03AM (#26023894)
Astronomy, seismology, microscopy.

There's an interesting query language, SciQL[1], built to support such use cases. It can be used with MonetDB.[2]

[1] https://projects.cwi.nl/scilens/Resources/SciQL.html

[2] https://www.youtube.com/watch?v=WaMo3oGTstY

Re:Apache Arrow 3.0 by nomel on Monday February 08, 2021 @09:13PM (#26073069)
R&D/manufacturing of consumer facing sensors, in my case.