This is an automated email from the ASF dual-hosted git repository.

karan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git


The following commit(s) were added to refs/heads/master by this push:
     new facd82b493 Add HLLC tests for empty strings that don't pass. (#14085)
facd82b493 is described below

commit facd82b4935d8d5313d93737a6de8bd8b7248f7b
Author: Gian Merlino <[email protected]>
AuthorDate: Mon Apr 17 03:16:42 2023 -0700

    Add HLLC tests for empty strings that don't pass. (#14085)
    
    I believe the test case illustrates the cause of the problem in #13950.
---
 .../apache/druid/hll/HyperLogLogCollectorTest.java | 27 ++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git 
a/processing/src/test/java/org/apache/druid/hll/HyperLogLogCollectorTest.java 
b/processing/src/test/java/org/apache/druid/hll/HyperLogLogCollectorTest.java
index d46faf4472..45a0116fa8 100644
--- 
a/processing/src/test/java/org/apache/druid/hll/HyperLogLogCollectorTest.java
+++ 
b/processing/src/test/java/org/apache/druid/hll/HyperLogLogCollectorTest.java
@@ -857,6 +857,33 @@ public class HyperLogLogCollectorTest
     }
   }
 
+  @Test
+  @Ignore("Doesn't pass; see https://github.com/apache/druid/issues/13950";)
+  public void testAddEmptyString()
+  {
+    final HyperLogLogCollector collector = 
HyperLogLogCollector.makeLatestCollector();
+    collector.add(HyperLogLogHash.getDefault().hash(""));
+    Assert.assertEquals(1, collector.estimateCardinality(), 0.01);
+
+    final byte[] collectorByteArray = collector.toByteArray();
+    final HyperLogLogCollector collector2 = 
HyperLogLogCollector.makeCollector(ByteBuffer.wrap(collectorByteArray));
+    Assert.assertEquals(1, collector2.estimateCardinality(), 0.01);
+  }
+
+  @Test
+  @Ignore("Doesn't pass; see https://github.com/apache/druid/issues/13950";)
+  public void testAddEmptyStringAndOneOtherValue()
+  {
+    final HyperLogLogCollector collector = 
HyperLogLogCollector.makeLatestCollector();
+    collector.add(HyperLogLogHash.getDefault().hash("abc"));
+    collector.add(HyperLogLogHash.getDefault().hash(""));
+    Assert.assertEquals(2, collector.estimateCardinality(), 0.01);
+
+    final byte[] collectorByteArray = collector.toByteArray();
+    final HyperLogLogCollector collector2 = 
HyperLogLogCollector.makeCollector(ByteBuffer.wrap(collectorByteArray));
+    Assert.assertEquals(2, collector2.estimateCardinality(), 0.01);
+  }
+
   // Provides a nice printout of error rates as a function of cardinality
   @Ignore
   @Test


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to