iotdb
iotdb copied to clipboard
Add PERCENTILE aggregation function and related validation
This pull request introduces the new percentile aggregation function to the IoTDB relational query engine, providing support for calculating percentiles over numeric columns. The changes include the implementation of the core percentile calculation logic, integration into the accumulator factory, and comprehensive tests for both correct behavior and error handling.
Percentile Aggregation Support
- Added
PercentileAccumulatorand supportingPercentileclass to implement percentile calculations for numeric types (INT32,INT64,FLOAT,DOUBLE,TIMESTAMP). [1] [2] - Integrated the new percentile accumulator into the
AccumulatorFactory, enabling both grouped and non-grouped percentile aggregations. [1] [2] [3]
Testing and Validation
- Added new integration tests to
IoTDBTableAggregationIT.javafor verifying percentile queries and their results, including grouped queries. - Extended exception tests to cover invalid usages of the
percentilefunction, such as wrong argument count, invalid percentage values, and unsupported data types.