Skip to content

Conversation

@ritchie46
Copy link
Contributor

@ritchie46 ritchie46 commented Feb 25, 2021

Polars uses the arrow::memory module. With the backwards incompatible change of #9495, the API is refactored to arrow::alloc.

By making alloc public, users can shift to the new changes.

Copy link
Contributor

@nevi-me nevi-me left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably an omission, the intention was to keep alloc public as memory was.

@github-actions
Copy link

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ritchie46 I am curious what your use case for using the allocator module directly is? It seems like the main public interface for Arrow aspires to a higher level (Array et al).

@alamb alamb closed this in 6b09bb6 Feb 25, 2021
@ritchie46
Copy link
Contributor Author

I use an wrapper type that is basically a Rust Vec combined with an arrow alloctor. AlignedVec. Because this is typed and has the same API as Vec I found this easier to work with.

It is used for instance in FromIterator to build a ChunkedArray (a wrapper around an arrow array) when I know I don't have null types.

When I don't have null values or I can just use an existing null buffer the AlignedVec is more performant for my case.

@alamb
Copy link
Contributor

alamb commented Feb 28, 2021

Thanks @ritchie46 -- the idea of AlignedVec is quite cool (something like that would likely be useful for us in IOx when we also want to go back / forth between Vec and arrow Arrays.

I wonder if it would make sense to consider move AlignedVec and ChunkedArray into the arrow crate itself. 🤔

@ritchie46
Copy link
Contributor Author

I do think that an AlignedVec in Arrow could speed up some code and make some internal code easier to maintain. If you want I could clean it up and propose a PR.

To my knowledge, the ChunkedArray's are already existent in the C++ implementation. I don't know if the ChunkedArray in Polars is similar to that implementation.

@alamb
Copy link
Contributor

alamb commented Mar 1, 2021

I do think that an AlignedVec in Arrow could speed up some code and make some internal code easier to maintain. If you want I could clean it up and propose a PR.

@ritchie46 I would enjoy helping review that code as well as ChunkedAray

I spent some time reviewing [`ChunkedArray])(https://github.com/ritchie46/polars/blob/6f2dfd43dbf7ab44cbd2904af57d3441a1b52853/polars/polars-core/src/chunked_array/mod.rs#L141-L157) and it looks very useful for something in IOx (the ingest path).

Thank you for the pointers (and the well commented code)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants