Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
@@ -1,7 +1,7 @@
name = "Tables"
uuid = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
authors = ["quinnj <[email protected]>"]
version = "1.10.1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also DataAPI.jl version requirement needs to be changed below.

Copy link
Author

@VEZY VEZY Apr 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ho yes I forgot this you're right. Done in aefedf6

version = "1.11.0"

[deps]
DataAPI = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a"
Expand Down
3 changes: 2 additions & 1 deletion src/Tables.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Tables

using LinearAlgebra, DataValueInterfaces, DataAPI, TableTraits, IteratorInterfaceExtensions, OrderedCollections

import DataAPI: rownumber
export rowtable, columntable

if !hasmethod(getproperty, Tuple{Tuple, Int})
Expand Down Expand Up @@ -250,6 +250,7 @@ struct Row{T} <: AbstractRow
end

Row(x::Row) = x
rownumber(x::Row) = rownumber(x.x)

"""
Tables.Columns(tbl)
Expand Down
5 changes: 3 additions & 2 deletions src/dicts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,10 @@ struct DictRow <: AbstractRow
row::Dict{Symbol, Any}
end

rownumber(x::DictRow) = getfield(x, :row)
columnnames(x::DictRow) = getfield(x, :names)
getcolumn(x::DictRow, i::Int) = get(getfield(x, :row), columnnames(x)[i], missing)
getcolumn(x::DictRow, nm::Symbol) = get(getfield(x, :row), nm, missing)
getcolumn(x::DictRow, i::Int) = get(rownumber(x), columnnames(x)[i], missing)
getcolumn(x::DictRow, nm::Symbol) = get(rownumber(x), nm, missing)

Base.IteratorSize(::Type{DictRowTable}) = Base.HasLength()
Base.length(x::DictRowTable) = length(getfield(x, :values))
Expand Down
1 change: 1 addition & 0 deletions src/fallbacks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ end

getcolumns(c::ColumnsRow) = getfield(c, :columns)
getrow(c::ColumnsRow) = getfield(c, :row)
rownumber(c::ColumnsRow) = getrow(c)

# AbstractRow interface
Base.@propagate_inbounds getcolumn(c::ColumnsRow, ::Type{T}, col::Int, nm::Symbol) where {T} = getcolumn(getcolumns(c), T, col, nm)[getrow(c)]
Expand Down
2 changes: 2 additions & 0 deletions src/matrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ struct MatrixRow{T} <: AbstractRow
source::MatrixRowTable{T}
end

rownumber(x::MatrixRow) = getfield(x, :row)

getcolumn(m::MatrixRow, ::Type, col::Int, nm::Symbol) =
getfield(getfield(m, :source), :matrix)[getfield(m, :row), col]
getcolumn(m::MatrixRow, i::Int) =
Expand Down
1 change: 1 addition & 0 deletions src/tofromdatavalues.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ struct IteratorRow{T} <: AbstractRow
end

getrow(r::IteratorRow) = getfield(r, :row)
rownumber(r::IteratorRow) = getrow(r)
wrappedtype(::Type{I}) where {T, I<:IteratorRow{T}} = T
wrappedtype(::Type{T}) where {T} = T

Expand Down