You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think there's something off in the C++ library that's responsible for this regression. I ran profvis on this query on the CRAN 16.1.0 version and a dev build, and the hotspot is RecordBatchReader$read_table called inside collect(), i.e. Acero is slower in evaluating the query and returning the batches. It does not seem to be anything in the R layer.
I'll try bisecting history to find out which commit introduces this.
I think I've figured it out. The query plans look the same but they're not--the 0:SourceNode doesn't show what options it has, and that's concealing what's up. (I thought I wrote an issue years ago about improving those print methods but I can't find it now.) The old path did a dplyr::select() to subset the columns before doing the aggregation, and that projection is getting pushed down into the SourceNode. But the 1:ProjectNode projection, which selects the columns for the 2:GroupByNode aggregation, doesn't get pushed down. So without that select(), we're reading a bunch of data into memory from the Parquet files that we immediately throw away.
I'll make a PR to add back that select(), and I'll fix the comment from before that was misleading and led me to believe that it wasn't doing anything of value.
Activity
nealrichardson commentedon Aug 9, 2024
Could you do
show_query()on both versions?thisisnic commentedon Aug 9, 2024
Here's the one from 16.1.0:
Will have to come back to the other one during/after posit::conf if nobody else gets there first as I don't have time now.
nealrichardson commentedon Aug 9, 2024
This is on dev. At least the part I was looking at (the
1:ProjectNode) is the same:Will have to do some profiling to see what's happening. The obvious suspect is #41576, but I don't have an intuition as to how it's responsible.
nealrichardson commentedon Aug 10, 2024
I think there's something off in the C++ library that's responsible for this regression. I ran
profvison this query on the CRAN 16.1.0 version and a dev build, and the hotspot isRecordBatchReader$read_tablecalled insidecollect(), i.e. Acero is slower in evaluating the query and returning the batches. It does not seem to be anything in the R layer.I'll try bisecting history to find out which commit introduces this.
nealrichardson commentedon Aug 10, 2024
Nope, it is #41576 somehow. That's the commit where this query gets slow. I will try to understand better and get a fix.
nealrichardson commentedon Aug 12, 2024
I think I've figured it out. The query plans look the same but they're not--the
0:SourceNodedoesn't show what options it has, and that's concealing what's up. (I thought I wrote an issue years ago about improving those print methods but I can't find it now.) The old path did adplyr::select()to subset the columns before doing the aggregation, and that projection is getting pushed down into the SourceNode. But the1:ProjectNodeprojection, which selects the columns for the2:GroupByNodeaggregation, doesn't get pushed down. So without thatselect(), we're reading a bunch of data into memory from the Parquet files that we immediately throw away.I'll make a PR to add back that
select(), and I'll fix the comment from before that was misleading and led me to believe that it wasn't doing anything of value.GH-43627: [R] Fix summarize() performance regression (pushdown) (#43649)
GH-43627: [R] Fix summarize() performance regression (pushdown) (#43649)
GH-43627: [R] Fix summarize() performance regression (pushdown) (#43649)