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

Tables.columns seem to flatten columns #280

Closed
aviks opened this issue Jan 8, 2022 · 1 comment
Closed

Tables.columns seem to flatten columns #280

aviks opened this issue Jan 8, 2022 · 1 comment

Comments

@aviks
Copy link
Member

aviks commented Jan 8, 2022

julia> db = SQLite.DB()
SQLite.DB(":memory:")

julia> nt = (a=[1,2,3],b=[2,3,4])
(a = [1, 2, 3], b = [2, 3, 4])

julia> SQLite.load!(nt, db, "mytest")
"mytest"

julia> result  = DBInterface.execute(db, "select * from mytest")
SQLite.Query(SQLite.Stmt(SQLite.DB(":memory:"), 2), Base.RefValue{Int32}(100), [:a, :b], Type[Union{Missing, Int64}, Union{Missing, Int64}], Dict(:a => 1, :b => 2), Base.RefValue{Int64}(0))

julia>  [Tables.columns(result)...;;]
6-element Vector{Int64}:
 1
 2
 3
 2
 3
 4

This was surprising since this type of code seems to work for other types of Tables compatible objects

julia> [Tables.columns(nt)...;;]
3×2 Matrix{Int64}:
 1  2
 2  3

Reports on slack stated that this works on DataFrame and Arrow objects.

Note that Tables.matrix does work successfully on SQLite resultsets

julia> Tables.matrix(result)
3×2 Matrix{Int64}:
 1  2
 2  3
 3  4

Is this a misunderstanding of how Row based Tables should behave? In which case, should this kind of code fail silently? Or is this a bug in the Tables.columns implementation in this package?

@aviks
Copy link
Member Author

aviks commented Jan 11, 2022

OK, this was confusing due to the fact that apparently repeated semicolons are a new feature in 1.7, and the code above was executed party in 1.6, and partly in 1.7 .

@aviks aviks closed this as completed Jan 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant