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

Get test suite passing tests again #389

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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 .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 5 additions & 0 deletions src/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion test/test_misc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down
4 changes: 2 additions & 2 deletions test/test_readwrite.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions test/test_table.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,)
Expand Down Expand Up @@ -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)
Expand Down