Skip to content

Commit a70416c

Browse files
fix: Boundary checks for maxStandardError in APPROX_COUNT_DISTINCT.
1 parent 8bad5af commit a70416c

File tree

2 files changed

+8
-2
lines changed
  • integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent
  • iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/aggregation

2 files changed

+8
-2
lines changed

integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBTableAggregationIT.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4157,6 +4157,12 @@ public void approxCountDistinctTest() {
41574157
new String[] {"time", "province", "_col2", "_col3"},
41584158
retArray,
41594159
DATABASE_NAME);
4160+
4161+
tableResultSetEqualTest(
4162+
"select approx_count_distinct(time,0.0040625),approx_count_distinct(time,0.26) from table1",
4163+
new String[] {"_col0", "_col1"},
4164+
new String[] {"10,11,"},
4165+
DATABASE_NAME);
41604166
}
41614167

41624168
@Test

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/aggregation/HyperLogLog.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ private static int indexBitLength(int numberOfBuckets) {
105105
}
106106

107107
private static int standardErrorToBuckets(double maxStandardError) {
108-
if (maxStandardError <= LOWEST_MAX_STANDARD_ERROR
109-
|| maxStandardError >= HIGHEST_MAX_STANDARD_ERROR) {
108+
if (maxStandardError < LOWEST_MAX_STANDARD_ERROR
109+
|| maxStandardError > HIGHEST_MAX_STANDARD_ERROR) {
110110
throw new IoTDBRuntimeException(
111111
String.format(
112112
"Max Standard Error must be in [%s, %s]: %s",

0 commit comments

Comments
 (0)