Feat: Add APPROX_MOST_FREQUENT Aggregation Function#15570
Merged
JackieTien97 merged 8 commits intoapache:masterfrom May 28, 2025
Merged
Feat: Add APPROX_MOST_FREQUENT Aggregation Function#15570JackieTien97 merged 8 commits intoapache:masterfrom
JackieTien97 merged 8 commits intoapache:masterfrom
Conversation
…st cases for approxMostFrequent
…ation and state management
JackieTien97
requested changes
May 27, 2025
iotdb-core/datanode/pom.xml
Outdated
Comment on lines
+395
to
+399
| <dependency> | ||
| <groupId>com.clearspring.analytics</groupId> | ||
| <artifactId>stream</artifactId> | ||
| <version>2.9.8</version> | ||
| </dependency> |
Contributor
There was a problem hiding this comment.
avoid using this dependency, it seems that it has stopped to be maintained and has a lot of CVEs.
JackieTien97
approved these changes
May 27, 2025
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new feature for approximate most frequent value aggregation (
approx_most_frequent) in Apache IoTDB. It includes changes to support this functionality in the query engine, test cases, and dependency updates. Below are the key changes:Feature Implementation: Approximate Most Frequent Aggregation
New Abstract Class for Accumulators: Added
AbstractApproxMostFrequentAccumulatorto handle common logic for approximate most frequent value aggregation. It includes methods for intermediate and final evaluations, reset functionality, and unsupported statistics handling. (iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/aggregation/AbstractApproxMostFrequentAccumulator.java)Specific Accumulators: Introduced specialized accumulator classes such as
BinaryApproxMostFrequentAccumulatorandBlobApproxMostFrequentAccumulatorto handle different data types, including binary and blob data. (iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/aggregation/BinaryApproxMostFrequentAccumulator.java,iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/aggregation/BlobApproxMostFrequentAccumulator.java) [1] [2]Accumulator Factory Enhancements: Updated
AccumulatorFactoryto supportAPPROX_MOST_FREQUENTaggregation type, with methods to create grouped and table accumulators for various data types. (iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/aggregation/AccumulatorFactory.java) [1] [2] [3]Dependency Updates
com.clearspring.analytics:stream(version 2.9.8) to support space-saving data structures used in the new aggregation functionality. (iotdb-core/datanode/pom.xml)Testing
approxMostFrequentTestto verify the functionality of theapprox_most_frequentaggregation. The test includes queries for different scenarios and validates the results against expected outputs. (integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBTableAggregationIT.java)Refactoring and Adjustments
ApproxCountDistinctAccumulatorto align with the new structure for approximate aggregations. (iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/aggregation/ApproxCountDistinctAccumulator.java) [1] [2]