Skip to content

Commit 175e431

Browse files
authored
fix error (#350)
1 parent 1f79db0 commit 175e431

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/dicts.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,14 @@ end
126126

127127
function subset(x::DictRowTable, inds; viewhint::Union{Bool,Nothing}=nothing, view::Union{Bool,Nothing}=nothing)
128128
if view !== nothing
129-
@warn "`view` keyword argument is deprecated for `Tables.subset`, use `viewhint` instead"
129+
@warn "`view` keyword argument is deprecated for `Tables.subset`, use `viewhint` instead" maxlog=10
130130
viewhint = view
131131
end
132132
values = viewhint === true ? Base.view(getfield(x, :values), inds) : getfield(x, :values)[inds]
133133
if inds isa Integer
134134
return DictRow(getfield(x, :names), values)
135135
else
136-
values isa AbstractVector || throw(ArgumentError("`Tables.subset`: invalid `inds` argument, expected `RowTable` output, got $(typeof(ret))"))
136+
values isa AbstractVector || throw(ArgumentError("`Tables.subset`: invalid `inds` argument, expected `RowTable` output, got $(typeof(values))"))
137137
return DictRowTable(getfield(x, :names), getfield(x, :types), values)
138138
end
139139
end

test/runtests.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ end
153153
@test Tables.subset(nt, 1:2, viewhint=false) == (a=[1,2], b=[4.0, 5.0], c=["7","8"])
154154
@test Tables.subset(nt, 1:2, viewhint=nothing) == (a=[1,2], b=[4.0, 5.0], c=["7","8"])
155155
@test_throws ArgumentError Tables.subset(nt, [1:2 1:2])
156+
@test_throws ArgumentError Tables.subset(Tables.dictrowtable(nt), [1:2 1:2])
156157

157158
@test Tables.subset(nt, 1, viewhint=true) == (a=1, b=4.0, c="7")
158159
rs = Tables.subset(nt, 1:2, viewhint=true)
@@ -1038,4 +1039,4 @@ end
10381039
@test DataAPI.ncol(Tables.dictrowtable(NamedTuple[])) == 0
10391040
@test DataAPI.nrow(Tables.dictrowtable([(a=1, b=2), (a=3, b=4), (a=5, b=6)])) == 3
10401041
@test DataAPI.ncol(Tables.dictrowtable([(a=1, b=2), (a=3, b=4), (a=5, b=6)])) == 2
1041-
end
1042+
end

0 commit comments

Comments
 (0)