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

ERROR: MethodError: no method matching unsafe_copyto!(::Vector{…}, ::Int64, ::SentinelArrays.SentinelVector{…}, ::Int64, ::Int64) #109

Closed
kafisatz opened this issue Nov 1, 2024 · 6 comments · Fixed by #108

Comments

@kafisatz
Copy link

kafisatz commented Nov 1, 2024

MWE

VERSION 
versioninfo() 
using CSV
using DataFrames 
using Pkg 
Pkg.status()
#fi= raw"c:\temp\test.csv"
fi=download("https://gist.githubusercontent.com/kafisatz/be010c9f3c7d53f7b585630a1b3e0e73/raw/776f73af8e55e47f94f2c18f6824ab076452c2ce/gistfile1.txt")
prev = CSV.read(fi,DataFrame,dateformat="dd.mm.yyyy",copycols=true,stringtype=String,pool=false);
unique!(prev);
unique(prev)

my error:

julia> unique(prev)
ERROR: MethodError: no method matching unsafe_copyto!(::Vector{Union{…}}, ::Int64, ::SentinelArrays.SentinelVector{Float64, Float64, Missing, Vector{…}}, ::Int64, ::Int64)
The function `unsafe_copyto!` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  unsafe_copyto!(::Array, ::Any, ::Array, ::Any, ::Any)
   @ Base array.jl:282
  unsafe_copyto!(::BitArray, ::Integer, ::Union{BitArray, Array}, ::Integer, ::Integer)
   @ Base bitarray.jl:456
  unsafe_copyto!(::Memory{T}, ::Any, ::Memory{T}, ::Any, ::Any) where T
   @ Base genericmemory.jl:128
  ...

Stacktrace:
 [1] getindex(x::SentinelArrays.ChainedVector{Union{Missing, Float64}, SentinelArrays.SentinelVector{Float64, Float64, Missing, Vector{Float64}}}, inds::UnitRange{Int64})
   @ SentinelArrays C:\Users\bernhard.konig\.julia\packages\SentinelArrays\v0rcL\src\chainedvector.jl:202
 [2] _threaded_getindex(selected_rows::UnitRange{Int64}, selected_columns::UnitRange{Int64}, df_columns::Vector{AbstractVector}, idx::DataFrames.Index)
   @ DataFrames C:\Users\bernhard.konig\.julia\packages\DataFrames\kcA9R\src\dataframe\dataframe.jl:574
 [3] getindex
   @ C:\Users\bernhard.konig\.julia\packages\DataFrames\kcA9R\src\dataframe\dataframe.jl:616 [inlined]
 [4] #unique#173
   @ C:\Users\bernhard.konig\.julia\packages\DataFrames\kcA9R\src\abstractdataframe\unique.jl:298 [inlined]
 [5] unique(df::DataFrame)
   @ DataFrames C:\Users\bernhard.konig\.julia\packages\DataFrames\kcA9R\src\abstractdataframe\unique.jl:295
 [6] top-level scope
   @ REPL[11]:1
Some type information was truncated. Use `show(err)` to see complete types.

@bkamins bkamins transferred this issue from JuliaData/DataFrames.jl Nov 1, 2024
@bkamins
Copy link
Member

bkamins commented Nov 1, 2024

Thank you for reporting. This is an issue in SentinelArrays.jl.

CC @quinnj

@quinnj
Copy link
Member

quinnj commented Nov 1, 2024

I can't reproduce. Can you share what versions you're on @kafisatz? I don't see any usages of unsafe_copyto! in current SentinelArrays version.

@devmotion
Copy link
Contributor

devmotion commented Nov 1, 2024

We hit this issue as well, see my comment in #108 which I opened to fix it (by the way this issue is a duplicate of #107 I think). We had to run Julia with multiple threads to reproduce the problem.

@devmotion
Copy link
Contributor

I don't see any usages of unsafe_copyto! in current SentinelArrays version.

#106 added the problematic unsafe_copyto!.

@devmotion
Copy link
Contributor

I just checked locally, and

  1. I can reproduce the problem by running Julia with multiple threads (used julia --threads=auto which gives me 6 threads), installing latest versions of CSV and DataFrames, and copying the script in the first comment to the REPL

  2. I confirmed locally that Fix getindex #108 fixes the issue (I followed the same procedure but also installed Fix getindex #108 together with CSV and DataFrames)

@devmotion devmotion mentioned this issue Nov 1, 2024
@quinnj
Copy link
Member

quinnj commented Nov 2, 2024

Thanks @devmotion for confirming; I was confused because indeed I just added the unsafe_copyto! usage, but my local branch got messed up and was unexpectedly behind. Going to look at your PR now.

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

Successfully merging a pull request may close this issue.

4 participants