Make udaf_default_* display/schema name helpers non-generic (214 KB smaller binary) - #24728
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
580bb8a to
39d0e53
Compare
udaf_default_* display/schema name helpers non-generic to reduce code sizeudaf_default_* display/schema name helpers non-generic (214 KB smaller binary)
alamb
left a comment
There was a problem hiding this comment.
This Diff looks lage, but if you ignore whitespace via https://github.com/apache/datafusion/pull/24728/changes?w=1 it is mich smaller (basically adding a bunch of docs and a builder)
| /// The default implementation is provided by [`UdafSchemaNameBuilder`] | ||
| fn schema_name(&self, params: &AggregateFunctionParams) -> Result<String> { | ||
| udaf_default_schema_name(self, params) | ||
| UdafSchemaNameBuilder::new(self.name(), params) |
There was a problem hiding this comment.
The core rationale is to use a single non generic function -- I also made a struct like builder to make the code easier to see too
| null_treatment, | ||
| } = params; | ||
|
|
||
| // exclude the first function argument(= column) in ordered set aggregate function, |
There was a problem hiding this comment.
this logic is all the same -- there is just now some more builder ceremony logic
| } | ||
| } | ||
|
|
||
| /// Builds the default implementation of [`AggregateUDFImpl::schema_name`]. |
There was a problem hiding this comment.
Here is a new builder for schema name -- it is basically the same pattern for all of the other types
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #24728 +/- ##
==========================================
- Coverage 81.47% 81.47% -0.01%
==========================================
Files 1122 1122
Lines 404140 404185 +45
Branches 404140 404185 +45
==========================================
+ Hits 329284 329292 +8
- Misses 55546 55577 +31
- Partials 19310 19316 +6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Extended teset failure seems to be failing on main too Here is a ticket |
Which issue does this PR close?
Rationale for this change
The default
udaf_default_*display / schema name helpers indatafusion/expr/src/udaf.rsare instantiated for each UDAFWhat changes are included in this PR?
AggregateUDFImpldefault methods to use the buildersCode size
Measured per the methodology in #24727, at merge base d66f4b9 and on this branch (39d0e53).
cargo llvm-lines --release -p datafusion-functions-aggregate --lib(29AggregateUDFImplimplementations):udaf_default_*display/schema name helperscargo llvm-lines --release -p datafusion-expr --lib(the builder bodies now compile here exactly once):cargo build --release --bin datafusion-cli:Are these changes tested?
Covered by existing tests
Are there any user-facing changes?
Yes, but not breaking: