Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C++] Concatenating a single array is a compaction utility #37878

Open
bkietz opened this issue Sep 26, 2023 · 5 comments
Open

[C++] Concatenating a single array is a compaction utility #37878

bkietz opened this issue Sep 26, 2023 · 5 comments

Comments

@bkietz
Copy link
Member

bkietz commented Sep 26, 2023

Describe the enhancement requested

Concatenation of a single array can be used (recommended? where?) as a memory compaction utility, since it produces a deep copy of the array. This should be better documented and should be tested, since the hot path of passing a single array through unchanged is tempting. (alternatively, Array::DeepCopy might be provided)

See also discussion in PRs:

Component(s)

C++

@lidavidm
Copy link
Member

IIRC, it's been recommended in mailing list posts whenever the question of copying an array comes up

It's also in Spark https://github.com/apache/spark/blob/60d02b444e2225b3afbe4955dabbea505e9f769c/python/pyspark/sql/connect/client/core.py#L1287

@jorisvandenbossche
Copy link
Member

Some previous discussion on this topic (this issue could be considered as a duplicate of that one if we think we want to add an actual utility, instead of only documenting the concat trick):

The workaround of concat_arrays is also mentioned for the bug in pickling serializing the full buffers instead of only the sliced buffers: #26685

@bkietz
Copy link
Member Author

bkietz commented Sep 29, 2023

Well if we haven't already documented concatenation for this purpose, I'd prefer to provide an explicit deep copy utility

@lidavidm
Copy link
Member

Even if it's not formally documented, it's used by other libraries and has been recommended to users before. I don't think we can change it at this point.

@bkietz
Copy link
Member Author

bkietz commented Sep 29, 2023

Sure, but to me it still seems better to alias concatenation of a single array to deep_copy and document that

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

No branches or pull requests

3 participants