spiraldb / vortex

An extensible, state-of-the-art columnar file format
https://vortex.dev
Apache License 2.0
996 stars 27 forks source link

IntoCanonical as VTable #1382

Closed gatesn closed 5 days ago

gatesn commented 5 days ago

The idea for the VTables change is that it is encodings who implement the behavior of arrays taking and returning type-erased ArrayDatas.

This was already the case for canonicalize, this PR just formalizes it as a separate behavior. It is also a useful function to call directly on arrays, hence why the non-vtable trait IntoCanonical still exists and is used to derive the IntoCanonicalVTable impls.

I still need to play around with non-owned vtable functions, the restriction being E::Array: TryFrom<ArrayData> would need to become for<'a> &'a E::Array: TryFrom<&'a ArrayData>, which is obviously impossible.... unless we only implement it for arrays that are #[repr(transparent] to an ArrayData. In other words, the macro'd BoolArray struct would need to lose its metadata field and become a unit struct that only holds ArrayData.

The implication here is that either:

FLUPS:

gatesn commented 5 days ago

Closed for #