Currently, aggregate functions are implemented in a statefull manner. The accumulator is stored internally in an aggregate_function::aggregate, requiring each query to instantiate new instances (see aggregate_function_selector's constructor, and note how it's called from selector::new_instance()). This makes aggregates hard to use in expressions, since expressions are stateless (with state only provided to evaluate()). To facilitate migration towards stateless expressions, we define a stateless_aggregate_function (modelled after user-defined aggregates, which are already stateless). This new struct defines the aggregate in terms of three scalar functions: one to aggregate a new input into an accumulator (provided in the first parameter), one to finalize an accumulator into a result, and one to reduce two accumulators for parallelized aggregation. An adapter of the new struct to the aggregate_function interface is also provided, to allow for incremental migration in the following patches.
46 lines
1.0 KiB
CMake
46 lines
1.0 KiB
CMake
add_library(db STATIC)
|
|
target_sources(db
|
|
PRIVATE
|
|
consistency_level.cc
|
|
system_keyspace.cc
|
|
virtual_table.cc
|
|
system_distributed_keyspace.cc
|
|
size_estimates_virtual_reader.cc
|
|
schema_tables.cc
|
|
cql_type_parser.cc
|
|
legacy_schema_migrator.cc
|
|
commitlog/commitlog.cc
|
|
commitlog/commitlog_replayer.cc
|
|
commitlog/commitlog_entry.cc
|
|
data_listeners.cc
|
|
functions/function.cc
|
|
hints/manager.cc
|
|
hints/resource_manager.cc
|
|
hints/host_filter.cc
|
|
hints/sync_point.cc
|
|
config.cc
|
|
extensions.cc
|
|
heat_load_balance.cc
|
|
large_data_handler.cc
|
|
marshal/type_parser.cc
|
|
batchlog_manager.cc
|
|
tags/utils.cc
|
|
view/view.cc
|
|
view/view_update_generator.cc
|
|
view/row_locking.cc
|
|
sstables-format-selector.cc
|
|
snapshot-ctl.cc
|
|
rate_limiter.cc
|
|
per_partition_rate_limit_options.cc)
|
|
target_include_directories(db
|
|
PUBLIC
|
|
${CMAKE_SOURCE_DIR})
|
|
target_link_libraries(db
|
|
PUBLIC
|
|
mutation
|
|
Seastar::seastar
|
|
xxHash::xxhash
|
|
PRIVATE
|
|
data_dictionary
|
|
cql3)
|