Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add narrowtypes functionality#14

Merged
quinnj merged 3 commits into
masterfrom
anandijain-master
Nov 19, 2020
Merged

Add narrowtypes functionality#14
quinnj merged 3 commits into
masterfrom
anandijain-master

Conversation

@quinnj

@quinnj quinnj commented Nov 13, 2020

Copy link
Copy Markdown
Member

@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

codecov Bot commented Nov 13, 2020

Copy link
Copy Markdown

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%) ⬇️

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

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

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 quinnj merged commit 52d0974 into master Nov 19, 2020
@quinnj quinnj deleted the anandijain-master branch November 19, 2020 05:59
@quinnj

quinnj commented Nov 19, 2020

Copy link
Copy Markdown
Member Author

Thanks for the contribution @anandijain!

@anandijain

Copy link
Copy Markdown
Contributor

Thanks for the help!

Comment thread src/TableOperations.jl
Comment on lines +429 to +431
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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

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

Successfully merging this pull request may close these issues.

3 participants