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

Fix case when type is provided for dropped columns #686

Merged
merged 1 commit into from
Jul 10, 2020
Merged

Conversation

quinnj
Copy link
Member

@quinnj quinnj commented Jul 10, 2020

Additional fix for #679. There was an alternative issue discovered in
#679 where a type was given for a dropped column, like CSV.File(file; types=Dict(:id=>Int32), select=["first"]). During parsing, it knew we
would drop the id column, so it parsed it as Missing, but then
tried to "set" the value to a Vector{Int32} which threw an error.
When dropping a column, we can basically ignore any provided type
information instead, so in the Header routine, we make sure to mark
the type of a column as Missing if it will be dropped.

Additional fix for #679. There was an alternative issue discovered in
 #679 where a type was given for a dropped column, like `CSV.File(file;
 types=Dict(:id=>Int32), select=["first"])`. During parsing, it knew we
 would drop the `id` column, so it parsed it as `Missing`, but then
 tried to "set" the value to a `Vector{Int32}` which threw an error.
 When dropping a column, we can basically ignore any provided type
 information instead, so in the `Header` routine, we make sure to mark
 the type of a column as `Missing` if it will be dropped.
@codecov
Copy link

codecov bot commented Jul 10, 2020

Codecov Report

Merging #686 into master will increase coverage by 0.11%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #686      +/-   ##
==========================================
+ Coverage   84.16%   84.28%   +0.11%     
==========================================
  Files          10       10              
  Lines        1800     1801       +1     
==========================================
+ Hits         1515     1518       +3     
+ Misses        285      283       -2     
Impacted Files Coverage Δ
src/header.jl 95.00% <100.00%> (+0.03%) ⬆️
src/utils.jl 82.60% <0.00%> (+0.96%) ⬆️

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 2658645...464617c. Read the comment docs.

@quinnj quinnj merged commit ad9cc64 into master Jul 10, 2020
@quinnj quinnj deleted the jq/679_part2 branch July 10, 2020 14:15
@kragol
Copy link
Contributor

kragol commented Jul 10, 2020

Thanks for this fix. As far as I can tell, it also fixes the issue in single-threaded mode, which makes your previous patch #683 unnecessary.

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.

None yet

2 participants