Skip to content

Commit

Permalink
disambiguate allunique signature (#3434)
Browse files Browse the repository at this point in the history
  • Loading branch information
bkamins authored Apr 5, 2024
1 parent d7f27e6 commit 3b4fcd8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@
release are now removed.
([#3422](https://github.com/JuliaData/DataFrames.jl/issues/3422))

## Julia compatibility change

* Ensure that `allunique(::AbstractDataFrame, ::Any)` always gets
interpreted as test for uniqueness of rows in the first positional argument
([#3434](https://github.com/JuliaData/DataFrames.jl/issues/3434))

# DataFrames.jl v1.6.1 Release Notes

## Bug fixes
Expand Down
5 changes: 5 additions & 0 deletions src/abstractdataframe/unique.jl
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@ function Base.allunique(df::AbstractDataFrame, cols=:)
Val(false), nothing, false, nothing, true)[1] == nrow(df)
end

# avoid invoking Base.allunique(f, iterator) introduced in Julia 1.11

Base.allunique(df::AbstractDataFrame, cols::Tuple) =
invoke(Base.allunique, Tuple{AbstractDataFrame, Any}, df, cols)

"""
unique(df::AbstractDataFrame; view::Bool=false, keep::Symbol=:first)
unique(df::AbstractDataFrame, cols; view::Bool=false, keep::Symbol=:first)
Expand Down
1 change: 1 addition & 0 deletions test/dataframe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2331,6 +2331,7 @@ end
@test allunique(df, [])
@test allunique(df, x -> 1:4)
@test allunique(df, [:a, :b] => ByRow(string))
@test_throws ArgumentError allunique(df, ())
end
end

Expand Down

0 comments on commit 3b4fcd8

Please sign in to comment.