Skip to content

Avoid calling vcat(dfs...) in combine() #1261

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

Merged
merged 1 commit into from
Oct 17, 2017
Merged

Avoid calling vcat(dfs...) in combine() #1261

merged 1 commit into from
Oct 17, 2017

Conversation

nalimilan
Copy link
Member

@nalimilan nalimilan commented Oct 15, 2017

This avoids compiling specialized methods for each number of arguments,
which can be very large when using groupby(). The code does not take
advantage at all of that information anyway. The code prior to
refactoring used to do that, by exporting
vcat(::Vector{AbstractDataFrame}). Use an internal method instead since
this is non-standard.

Incidentally, this fixes a small bug introduced in the refactoring: when
working with an empty data frame, vcat() was called, and it returns
Any[0], which surprisingly implied the addition of a bogus x1 column to
the result. The test was actually correct before refactoring.

Refactoring was done at JuliaData/DataTables.jl#45. See also report at https://discourse.julialang.org/t/stack-overflow-in-dataframes-group-by/6357.

Cc: @ExpandingMan

This avoids compiling specialized methods for each number of arguments,
which can be very large when using groupby(). The code does not take
advantage at all of that information anyway. The code prior to
refactoring used to do that, by exporting
vcat(::Vector{AbstractDataFrame}). Use an internal method instead since
this is non-standard.

Incidentally, this fixes a small bug introduced in the refactoring: when
working with an empty data frame, vcat() was called, and it returns
Any[0], which surprisingly implied the addition of a bogus x1 column to
the result. The test was actually correct before refactoring.
@nalimilan nalimilan requested a review from cjprybol October 15, 2017 17:27
@coveralls
Copy link

coveralls commented Oct 15, 2017

Coverage Status

Coverage increased (+0.02%) to 72.568% when pulling c939369 on nl/vcat into 8cf2be9 on master.

Copy link
Contributor

@cjprybol cjprybol left a comment

Choose a reason for hiding this comment

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

I had no idea vcat(args...) recompiled each time it received a new number of arguments, thanks for the explanation (here and on Discourse) and the fix!

@cjprybol cjprybol merged commit 86c6145 into master Oct 17, 2017
@cjprybol cjprybol deleted the nl/vcat branch October 17, 2017 19:18
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