Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Respect copycols when building DataFrame from Tables.CopiedColumns (#…
…2656) * Respect copycols when building DataFrame from Tables.CopiedColumns Fixes apache/arrow-julia#146. The issue here was we were just ignoring `copycols` entirely when building DataFrame from `Tables.CopiedColumns`. Which is mostly fine because `CopiedColumns` implies DataFrames can assume ownership of the columns. The wrinkle comes in when you consider cases like `Arrow.Table`, which wraps columns in `Tables.CopiedColumns`, not necessarily because copies have been made, but because the data is immutable, so it should be safe for other tables to assume ownership. The problem is when users want to _mutate_ those columns, they need to make copies of them, so naturally users try `DataFrame(::Arrow.Table; copycols=true)`, but then that doesn't actually make copies. The proposal here just intercepts the top-level `DataFrame(::CopiedColumns)` constructor and passes `copycols=false` as the default, so if users pass `copycols=true`, it will still be respected. * Update src/other/tables.jl Co-authored-by: Bogumił Kamiński <[email protected]>
- Loading branch information