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

Use columntable in datavaluerows for col sources #279

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
10 changes: 9 additions & 1 deletion src/tofromdatavalues.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,15 @@ IteratorInterfaceExtensions.getiterator(x::MyTable) = Tables.datavaluerows(x)
```
"""
function datavaluerows(x)
r = Tables.rows(x)
x2 = if Tables.columnaccess(x)
Tables.columntable(x)
elseif Tables.rowaccess(x)
x
else
error("Invalid input table, must either declare to have a Tables.rows or Tables.columns method.")
end

r = Tables.rows(x2)
davidanthoff marked this conversation as resolved.
Show resolved Hide resolved
s = Tables.schema(r)
s === nothing && error("Schemaless sources cannot be passed to datavaluerows.")
return DataValueRowIterator{datavaluenamedtuple(s), typeof(s), typeof(r)}(r)
Expand Down