forked from duckdb/duckdb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Force aggregate state to be
trivially_destructible
, unless `Aggrega…
…teDestructorType::LEGACY` is used (duckdb#14615) Follow-up from duckdb#14571 We should not use STL containers in aggregate states. Aggregate states can be offloaded to disk when we are doing larger-than-memory computations. STL containers are STL-specific, and make no guarantees on being "relocatable", e.g. they can contain pointers to themselves. If they contain a pointer to themselves, we off-load to disk, and then reload to a different memory location, that pointer becomes invalid. As such, it would be better to not use STL containers in aggregate states. An easy way to enforce this (which is probably a good idea anyway) is to ensure aggregate states must be trivially destructible. This PR enforces this property by triggering a `static_assert` in `AggregateFunction::StateInitialize` when the state is not trivially destructible. Note that we add a temporary work-around - `AggregateDestructorType::LEGACY` can be specified in the template to allow non-trivially destructible aggregate states. We should refactor the aggregates that use this and remove this eventually.
- Loading branch information
Showing
8 changed files
with
95 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters