Reject transformations on SubDataFrame with copycols=false#3522
Reject transformations on SubDataFrame with copycols=false#3522bkamins merged 10 commits intoJuliaData:mainfrom
Conversation
|
Fixes #3515 |
bkamins
left a comment
There was a problem hiding this comment.
Thank you for the PR. It catches a bug that we have. I have left some suggestions.
| return newdf | ||
| end | ||
|
|
||
| function manipulate(dfv::SubDataFrame, @nospecialize(args...); copycols::Bool, keeprows::Bool, |
There was a problem hiding this comment.
could you please remove changes that are only for layout reasons? This will simplify analysis of commits to main in the future. Thank you!.
src/abstractdataframe/selection.jl
Outdated
| push!(newinds, ind_idx) | ||
| else | ||
| newind = index(dfv)[ind] | ||
| push!(newinds, newind) | ||
| end | ||
| end |
There was a problem hiding this comment.
| push!(newinds, ind_idx) | |
| else | |
| newind = index(dfv)[ind] | |
| push!(newinds, newind) | |
| end | |
| end | |
| end | |
| newind = index(dfv)[ind] | |
| push!(newinds, newind) | |
| end |
There was a problem hiding this comment.
This is a good catch. The following change is needed in the code. (just please check the alignment of lines as I edit in a browser).
Also can you please add the following test:
julia> df = DataFrame(a = [1, 2, 3], b = [1,2,3])
3×2 DataFrame
Row │ a b
│ Int64 Int64
─────┼──────────────
1 │ 1 1
2 │ 2 2
3 │ 3 3
julia> v = @view df[1:2, :]
2×2 SubDataFrame
Row │ a b
│ Int64 Int64
─────┼──────────────
1 │ 1 1
2 │ 2 2
julia> select(v, "a", "b", copycols=false)
newinds = Any[]
0×0 SubDataFrame
this is on main and it is incorrect as you see as the result should be:
2×2 DataFrame
Row │ a b
│ Int64 Int64
─────┼──────────────
1 │ 1 1
2 │ 2 2
e4f6745 to
3ab53c7
Compare
|
Thanks for pointing that out — you’re absolutely right. I’ve removed all layout-only changes and reverted the file to upstream formatting. Please let me know if this looks good now. |
|
Thank you! I added one small suggestion. Otherwise it looks good. Do you know why nightly fails? |
Co-authored-by: Bogumił Kamiński <bkamins@sgh.waw.pl>
|
Thank you for the review and the suggestion — I’ve applied it. I’m not sure yet why nightly fails. I’ll investigate the nightly logs locally and report back once I understand the cause. |
|
OK - I understand that |
bkamins
left a comment
There was a problem hiding this comment.
Looks good. Thank you! The nightly fail is unrelated.
Co-authored-by: Milan Bouchet-Valat <nalimilan@club.fr>
Co-authored-by: Milan Bouchet-Valat <nalimilan@club.fr>
Co-authored-by: Milan Bouchet-Valat <nalimilan@club.fr>
ae7dacd to
1964644
Compare
src/abstractdataframe/selection.jl
Outdated
| newinds = Any[] | ||
| seen_single_column = Set{Int}() | ||
| for ind in args | ||
| if ind isa Pair || ind isa AbstractVecOrMat{<:Pair} |
There was a problem hiding this comment.
still some indentation issues here
There was a problem hiding this comment.
This is still the place where the issue is. The code is indended by 3 spaces and should be by 4
There was a problem hiding this comment.
I have fixed the issue.
Thank you!
|
Hi, I think you accenditenally run some autoformatter. I requested to fix just one place where indentation was incorrect. Could you please revert last commit and just fix the indentation in the PR? Thank you! |
346bc91 to
a04f14b
Compare
|
The changes are not reverted |
a04f14b to
1964644
Compare
|
I have reset the branch to commit 1964644 and ensured only the intended indentation structure is present. |
src/abstractdataframe/selection.jl
Outdated
| seen_single_column = Set{Int}() | ||
| for ind in args | ||
| if ind isa Pair || ind isa AbstractVecOrMat{<:Pair} | ||
| throw(ArgumentError( |
There was a problem hiding this comment.
the PR still has wrong indentations. Sometimes 3 spaces, sometimes 2 spaces. Please make sure that in the PR all indentations are at 3 spaces. Thank you!
There was a problem hiding this comment.
You mean 4 spaces, right? ;-)
There was a problem hiding this comment.
I think everything is fine now!
|
Thank you! |
This PR rejects transformations on SubDataFrame when copycols=false and adds a regression test ensuring a clear ArgumentError mentioning copycols=false