diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e06faac..b57725d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: fail-fast: false matrix: version: - - '1.0' + - '1.3' - '1' # automatically expands to the latest stable 1.x release of Julia - 'nightly' os: diff --git a/src/util.jl b/src/util.jl index c7f45a8..998f50e 100644 --- a/src/util.jl +++ b/src/util.jl @@ -240,6 +240,11 @@ function _map_params(f, T, S) end _map_params(f, T::Type{Tuple{}},S::Type{Tuple{}}) = () +_map_params(f, T::Type{NamedTuple{(), Tuple{}}},S::Type{NamedTuple{(), Tuple{}}}) = () + +if !hasmethod(Base.reduce_empty, Tuple{typeof(Base.add_sum), Union{}}) + @noinline Base.reduce_empty(::typeof(Base.add_sum), ::Type{Union{}}) = throw(ArgumentError("reducing over an empty collection is not allowed")) +end map_params(f, ::Type{T}, ::Type{S}) where {T,S} = f(T,S) @inline _tuple_type_head(::Type{T}) where {T<:Tuple} = Base.tuple_type_head(T) diff --git a/test/test_misc.jl b/test/test_misc.jl index e2d0537..bd0deba 100644 --- a/test/test_misc.jl +++ b/test/test_misc.jl @@ -28,7 +28,7 @@ end @testset "printing" begin x = distribute(NDSparse([1], [1]), 1) @test repr(x) == """ - 1-d Distributed NDSparse with 1 values (Int64) in 1 chunks: + 1-d Distributed NDSparse with 1 values ($Int) in 1 chunks: 1 │ ──┼── 1 │ 1""" diff --git a/test/test_readwrite.jl b/test/test_readwrite.jl index 7ee942e..6b7d24f 100644 --- a/test/test_readwrite.jl +++ b/test/test_readwrite.jl @@ -24,7 +24,7 @@ end end -path = joinpath(dirname(@__FILE__), "..","test", "sample") +path = joinpath(dirname(pathof(JuliaDB)), "..","test", "sample") files = glob("*.csv", path) const spdata_dist = loadndsparse(files, type_detect_rows=4, indexcols=1:2, usecache=false, chunks=2) @@ -41,7 +41,7 @@ const spdata = loadndsparse(files; distributed=false, header_exists=true, indexcols=1:2) -files = glob("*.csv", "sample") +files = glob("*.csv", path) shuffle_files = shuffle(files) const spdata_unordered = loadndsparse(shuffle_files; distributed=false, diff --git a/test/test_table.jl b/test/test_table.jl index 145b997..59844d9 100644 --- a/test/test_table.jl +++ b/test/test_table.jl @@ -12,16 +12,16 @@ import JuliaDB: pkeynames, pkeys, excludecols, select, transform end), t, :x, select=:z) == table([1, 2], [6, 15], names=Symbol[:x, :y]) @test groupreduce(:y => (+), t, :x, select=:z) == table([1, 2], [6, 15], names=Symbol[:x, :y]) x = ndsparse(["a", "b"], [3, 4], chunks=2) - @test (keytype(x), eltype(x)) == (Tuple{String}, Int64) + @test (keytype(x), eltype(x)) == (Tuple{String}, Int) x = ndsparse((date = Date.(2014:2017),), [4:7;], chunks=2) @test x[Date("2015-01-01")] == 5 - @test (keytype(x), eltype(x)) == (Tuple{Date}, Int64) + @test (keytype(x), eltype(x)) == (Tuple{Date}, Int) x = ndsparse((["a", "b"], [3, 4]), [5, 6], chunks=2) - @test (keytype(x), eltype(x)) == (Tuple{String,Int64}, Int64) + @test (keytype(x), eltype(x)) == (Tuple{String,Int}, Int) @test x["a", 3] == 5 x = ndsparse((["a", "b"], [3, 4]), ([5, 6], [7.0, 8.0]), chunks=2) x = ndsparse((x = ["a", "a", "b"], y = [3, 4, 4]), (p = [5, 6, 7], q = [8.0, 9.0, 10.0]), chunks=2) - @test (keytype(x), eltype(x)) == (Tuple{String,Int64}, NamedTuple{(:p,:q),Tuple{Int64,Float64}}) + @test (keytype(x), eltype(x)) == (Tuple{String,Int}, NamedTuple{(:p,:q),Tuple{Int,Float64}}) @test x["a", :] == ndsparse((y = [3, 4],), Columns((p = [5, 6], q = [8.0, 9.0]))) x = ndsparse([1, 2], [3, 4], chunks=2) @test pkeynames(x) == (1,) @@ -223,7 +223,7 @@ import JuliaDB: pkeynames, pkeys, excludecols, select, transform @test isequal(convertmissing(t, DataValue), t2) @test isequal(convertmissing(t2, Missing), t) - @test typeof(column(dropmissing(t, :x), :x)) <: Dagger.DArray{Int64,1} + @test typeof(column(dropmissing(t, :x), :x)) <: Dagger.DArray{Int,1} t = table(["a", "b", "c"], [0.01, 0.05, 0.07], [2, 1, 0], names=[:n, :t, :x], chunks=2) @test filter((p->p.x / p.t < 100), t) == table(String["b", "c"], [0.05, 0.07], [1, 0], names=Symbol[:n, :t, :x]) x = ndsparse((n = ["a", "b", "c"], t = [0.01, 0.05, 0.07]), [2, 1, 0], chunks=2)