This is an automated email from the ASF dual-hosted git repository.
xiangfu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push:
new 4b30fa5c02 Fixing the flaky test TupleSketchIntegrationTest (#11290)
4b30fa5c02 is described below
commit 4b30fa5c02bda49856e13d3c8b8df1529cc4fa3a
Author: Xiang Fu <[email protected]>
AuthorDate: Tue Aug 8 19:37:42 2023 -0700
Fixing the flaky test TupleSketchIntegrationTest (#11290)
---
.../pinot/integration/tests/TupleSketchIntegrationTest.java | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git
a/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/TupleSketchIntegrationTest.java
b/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/TupleSketchIntegrationTest.java
index e0e05d1075..d26fb38141 100644
---
a/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/TupleSketchIntegrationTest.java
+++
b/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/TupleSketchIntegrationTest.java
@@ -23,6 +23,7 @@ import com.google.common.collect.ImmutableList;
import java.io.File;
import java.io.IOException;
import java.nio.ByteBuffer;
+import java.util.Base64;
import java.util.Random;
import org.apache.avro.Schema.Field;
import org.apache.avro.Schema.Type;
@@ -30,6 +31,7 @@ import org.apache.avro.file.DataFileWriter;
import org.apache.avro.generic.GenericData;
import org.apache.avro.generic.GenericDatumWriter;
import org.apache.commons.io.FileUtils;
+import org.apache.datasketches.tuple.Sketch;
import org.apache.datasketches.tuple.aninteger.IntegerSketch;
import org.apache.datasketches.tuple.aninteger.IntegerSummary;
import org.apache.pinot.core.common.ObjectSerDeUtils;
@@ -95,8 +97,13 @@ public class TupleSketchIntegrationTest extends
BaseClusterIntegrationTest {
MET_TUPLE_SKETCH_BYTES, MET_TUPLE_SKETCH_BYTES,
MET_TUPLE_SKETCH_BYTES, MET_TUPLE_SKETCH_BYTES,
DEFAULT_TABLE_NAME);
JsonNode jsonNode = postQuery(query);
- assertTrue(jsonNode.get("resultTable").get("rows").get(0).get(0).asLong()
> 0);
-
assertEquals(jsonNode.get("resultTable").get("rows").get(0).get(1).asText().length(),
1756);
+ long distinctCount =
jsonNode.get("resultTable").get("rows").get(0).get(0).asLong();
+ byte[] rawSketchBytes =
Base64.getDecoder().decode(jsonNode.get("resultTable").get("rows").get(0).get(1).asText());
+ Sketch<IntegerSummary> deserializedSketch =
+
ObjectSerDeUtils.DATA_SKETCH_INT_TUPLE_SER_DE.deserialize(rawSketchBytes);
+
+ assertTrue(distinctCount > 0);
+ assertEquals(Double.valueOf(deserializedSketch.getEstimate()).longValue(),
distinctCount);
assertTrue(jsonNode.get("resultTable").get("rows").get(0).get(2).asLong()
> 0);
assertTrue(jsonNode.get("resultTable").get("rows").get(0).get(3).asLong()
> 0);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]