JuliaData / TableOperations.jl

Common table operations on Tables.jl interface implementations
Other
46 stars 9 forks source link

Add narrowtypes functionality #14

Closed quinnj closed 3 years ago

quinnj commented 3 years ago

@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.

codecov[bot] commented 3 years ago

Codecov Report

Merging #14 (f4c4d50) into master (b3703ba) will decrease coverage by 2.04%. The diff coverage is 62.50%.

Impacted file tree graph

@@            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     
Impacted Files Coverage Δ
src/TableOperations.jl 88.68% <62.50%> (-2.05%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update b3703ba...f4c4d50. Read the comment docs.

anandijain commented 3 years ago

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 x->filter(f, x), is this needed?

anandijain commented 3 years ago

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
quinnj commented 3 years ago

Thanks for the contribution @anandijain!

anandijain commented 3 years ago

Thanks for the help!