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

Add test for issue #3340 which exposed upstream issues with the use of TimSort #3341

Merged
merged 5 commits into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ PrettyTables = "2.1"
Reexport = "0.1, 0.2, 1"
SentinelArrays = "1.2"
ShiftedArrays = "1, 2"
SortingAlgorithms = "0.1, 0.2, 0.3, 1"
SortingAlgorithms = "1.1.1"
bkamins marked this conversation as resolved.
Show resolved Hide resolved
bkamins marked this conversation as resolved.
Show resolved Hide resolved
TableTraits = "0.4, 1"
Tables = "1.9.0"
Unitful = "1"
Expand Down
18 changes: 18 additions & 0 deletions test/sort.jl
Original file line number Diff line number Diff line change
Expand Up @@ -403,4 +403,22 @@ end
@test issorted(df[1:5, :])
end

@testset "issue #3340, mostly downstream testing for SortingAlgorithms.jl and Base.Sort" begin
Random.seed!(1234)
for i in 1:10
df = DataFrame(units = round.(Int, 1 ./ rand(2000)),
sku = [rand() < .084 ? missing : String31(randstring(8)) for _ in 1:2000])
@test issorted(sort(select(df, [:sku, :units]), :sku).sku)
@test issorted(sort(select(df, [:sku, :units]), :units).units)
@test issorted(sort(select(df, [:sku, :units]).sku))
@test issorted(sort(df, :sku).sku)

o = Base.Order.Perm(Base.Order.ForwardOrdering(), df.sku)
a = DataFrames.SortingAlgorithms.TimSortAlg()
x = collect(1:nrow(df))
sort!(x, a, o)
@test issorted(df[x, :sku])
end
end

end # module