This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new a70416cfdb1 fix: Boundary checks for maxStandardError in
APPROX_COUNT_DISTINCT.
a70416cfdb1 is described below
commit a70416cfdb138fce3a9fcdf870847fea13f106fa
Author: FearfulTomcat27 <[email protected]>
AuthorDate: Fri May 9 18:37:49 2025 +0800
fix: Boundary checks for maxStandardError in APPROX_COUNT_DISTINCT.
---
.../iotdb/relational/it/query/recent/IoTDBTableAggregationIT.java | 6 ++++++
.../operator/source/relational/aggregation/HyperLogLog.java | 4 ++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git
a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBTableAggregationIT.java
b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBTableAggregationIT.java
index 274868fdfc6..3608cd00f85 100644
---
a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBTableAggregationIT.java
+++
b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBTableAggregationIT.java
@@ -4157,6 +4157,12 @@ public class IoTDBTableAggregationIT {
new String[] {"time", "province", "_col2", "_col3"},
retArray,
DATABASE_NAME);
+
+ tableResultSetEqualTest(
+ "select
approx_count_distinct(time,0.0040625),approx_count_distinct(time,0.26) from
table1",
+ new String[] {"_col0", "_col1"},
+ new String[] {"10,11,"},
+ DATABASE_NAME);
}
@Test
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/aggregation/HyperLogLog.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/aggregation/HyperLogLog.java
index 94836eba861..1dabd5c1ed9 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/aggregation/HyperLogLog.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/aggregation/HyperLogLog.java
@@ -105,8 +105,8 @@ public class HyperLogLog {
}
private static int standardErrorToBuckets(double maxStandardError) {
- if (maxStandardError <= LOWEST_MAX_STANDARD_ERROR
- || maxStandardError >= HIGHEST_MAX_STANDARD_ERROR) {
+ if (maxStandardError < LOWEST_MAX_STANDARD_ERROR
+ || maxStandardError > HIGHEST_MAX_STANDARD_ERROR) {
throw new IoTDBRuntimeException(
String.format(
"Max Standard Error must be in [%s, %s]: %s",