Add narrowtypes functionality#14
Conversation
Codecov Report
@@ Coverage Diff @@
## master #14 +/- ##
==========================================
- Coverage 90.73% 88.68% -2.05%
==========================================
Files 1 1
Lines 205 221 +16
==========================================
+ Hits 186 196 +10
- Misses 19 25 +6
Continue to review full report at Codecov.
|
|
Thanks a lot for the help! These changes all look good. I just added some tests, which I'll push now. I based them off of other testsets. Many of the other lazy structs have functions that return an anonymous function ie |
|
Actually, I'm able to push to my fork, but I think since I don't have juliadata/ write access, I won't be able to add commits (is that right?) Since it's so few lines, here are the tests: ctable_type_any = (A=Any[1, missing, 3], B=Any[1.0, 2.0, 3.0], C=Any["hey", "there", "sailor"])
@testset "TableOperations.narrowtypes" begin
nt = TableOperations.narrowtypes(ctable_type_any)
@test Tables.istable(nt)
@test Tables.columnaccess(nt)
@test Tables.schema(nt) == Tables.schema(ctable)
@test Tables.columnnames(nt) == Tables.columnnames(ctable)
end
|
|
Thanks for the contribution @anandijain! |
|
Thanks for the help! |
| promoting the types of each actual value for each column. Useful, for example, when a columnar table source | ||
| has a column type of `Any`, and a more concrete type is desired. Uses `Base.promote_typejoin` internally | ||
| to do actual type promotion. |
There was a problem hiding this comment.
Note that promote_typejoin is just typejoin with special handling for Missing and Nothing, so speaking about promotion is a bit misleading. Maybe using promote be default would be more useful? For example if you have a mix of Int and Float64, promote_typejoin will give Real, which isn't ideal.
@anandijain, I'm not able to push to your branch, but I made some changes and rebased your changes here; take a look if it seems ok to you. Then we can finish your todos by adding docs/tests.