You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by le...@apache.org on 2020/06/02 04:26:08 UTC

[incubator-datasketches-hive] branch revert-51-theta-sketch-estimate-fix-byte-length created (now af59813)

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

leerho pushed a change to branch revert-51-theta-sketch-estimate-fix-byte-length
in repository https://gitbox.apache.org/repos/asf/incubator-datasketches-hive.git.


      at af59813  Revert "Fix theta sketch estimation if input has extra bytes"

This branch includes the following new commits:

     new af59813  Revert "Fix theta sketch estimation if input has extra bytes"

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org


[incubator-datasketches-hive] 01/01: Revert "Fix theta sketch estimation if input has extra bytes"

Posted by le...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

leerho pushed a commit to branch revert-51-theta-sketch-estimate-fix-byte-length
in repository https://gitbox.apache.org/repos/asf/incubator-datasketches-hive.git

commit af59813a4384884821a36da6f9e1f7aabd953f3f
Author: Lee Rhodes <le...@users.noreply.github.com>
AuthorDate: Mon Jun 1 21:26:02 2020 -0700

    Revert "Fix theta sketch estimation if input has extra bytes"
---
 .../datasketches/hive/theta/EstimateSketchUDF.java   |  3 +--
 .../hive/theta/EstimateSketchUDFTest.java            | 20 --------------------
 2 files changed, 1 insertion(+), 22 deletions(-)

diff --git a/src/main/java/org/apache/datasketches/hive/theta/EstimateSketchUDF.java b/src/main/java/org/apache/datasketches/hive/theta/EstimateSketchUDF.java
index 058f875..dd4c1a7 100644
--- a/src/main/java/org/apache/datasketches/hive/theta/EstimateSketchUDF.java
+++ b/src/main/java/org/apache/datasketches/hive/theta/EstimateSketchUDF.java
@@ -56,8 +56,7 @@ public class EstimateSketchUDF extends UDF {
       return 0.0;
     }
 
-    final byte[] serializedSketch = new byte[binarySketch.getLength()];
-    System.arraycopy(binarySketch.getBytes(), 0, serializedSketch, 0, binarySketch.getLength());
+    final byte[] serializedSketch = binarySketch.getBytes();
 
     if (serializedSketch.length <= EMPTY_SKETCH_SIZE_BYTES) {
       return 0.0;
diff --git a/src/test/java/org/apache/datasketches/hive/theta/EstimateSketchUDFTest.java b/src/test/java/org/apache/datasketches/hive/theta/EstimateSketchUDFTest.java
index d538afa..3e2811f 100644
--- a/src/test/java/org/apache/datasketches/hive/theta/EstimateSketchUDFTest.java
+++ b/src/test/java/org/apache/datasketches/hive/theta/EstimateSketchUDFTest.java
@@ -97,24 +97,4 @@ public class EstimateSketchUDFTest {
     assertEquals(128.0, testResult);
   }
 
-  @Test
-  public void evaluateRespectsByteLength() {
-    // In some instances, the BytesWritable buffer returned by getBytes() might be larger than the actual sketch bytes.
-    // getLength() should give the correct length to use.
-    //
-    // https://github.com/apache/incubator-datasketches-hive/issues/50
-
-    byte[] inputBytes = new byte[]{
-            (byte) 0x01, (byte) 0x03, (byte) 0x03, (byte) 0x00,
-            (byte) 0x00, (byte) 0x3a, (byte) 0xcc, (byte) 0x93,
-            (byte) 0x15, (byte) 0xf9, (byte) 0x7d, (byte) 0xcb,
-            (byte) 0xbd, (byte) 0x86, (byte) 0xa1, (byte) 0x05,
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00
-    };
-    BytesWritable input = new BytesWritable(inputBytes, 16);
-    EstimateSketchUDF estimate = new EstimateSketchUDF();
-    Double testResult = estimate.evaluate(input);
-    assertEquals(1.0, testResult, 0.0);
-  }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org