| <!DOCTYPE HTML> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc --> |
| <title>Union (datasketches-java 4.0.0 API)</title> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../../jquery/jquery-ui.min.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../../jquery-ui.overrides.css" title="Style"> |
| <script type="text/javascript" src="../../../../script.js"></script> |
| <script type="text/javascript" src="../../../../jquery/jszip/dist/jszip.min.js"></script> |
| <script type="text/javascript" src="../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script> |
| <!--[if IE]> |
| <script type="text/javascript" src="../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script> |
| <![endif]--> |
| <script type="text/javascript" src="../../../../jquery/jquery-3.6.0.min.js"></script> |
| <script type="text/javascript" src="../../../../jquery/jquery-ui.min.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="Union (datasketches-java 4.0.0 API)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var data = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":9,"i6":9,"i7":10,"i8":10,"i9":9,"i10":9,"i11":10,"i12":10,"i13":10,"i14":9,"i15":9,"i16":10,"i17":10,"i18":10,"i19":10,"i20":10,"i21":10,"i22":10,"i23":10,"i24":10,"i25":10,"i26":10,"i27":10,"i28":10,"i29":10,"i30":10,"i31":10,"i32":10,"i33":10,"i34":10,"i35":10,"i36":10,"i37":9}; |
| var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; |
| var altColor = "altColor"; |
| var rowColor = "rowColor"; |
| var tableTab = "tableTab"; |
| var activeTableTab = "activeTableTab"; |
| var pathtoroot = "../../../../"; |
| var useModuleDirectories = true; |
| loadScripts(document, 'script');</script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <header role="banner"> |
| <nav role="navigation"> |
| <div class="fixedNav"> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a id="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <a id="navbar.top.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../index.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/Union.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../../../allclasses.html">All Classes</a></li> |
| </ul> |
| <ul class="navListSearch"> |
| <li><label for="search">SEARCH:</label> |
| <input type="text" id="search" value="search" disabled="disabled"> |
| <input type="reset" id="reset" value="reset" disabled="disabled"> |
| </li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_top"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a id="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| </div> |
| <div class="navPadding"> </div> |
| <script type="text/javascript"><!-- |
| $('.navPadding').css('padding-top', $('.fixedNav').css("height")); |
| //--> |
| </script> |
| </nav> |
| </header> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <main role="main"> |
| <div class="header"> |
| <div class="subTitle"><span class="packageLabelInType">Package</span> <a href="package-summary.html">org.apache.datasketches.hll</a></div> |
| <h2 title="Class Union" class="title">Class Union</h2> |
| </div> |
| <div class="contentContainer"> |
| <ul class="inheritance"> |
| <li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">java.lang.Object</a></li> |
| <li> |
| <ul class="inheritance"> |
| <li>org.apache.datasketches.hll.Union</li> |
| </ul> |
| </li> |
| </ul> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <hr> |
| <pre>public class <span class="typeNameLabel">Union</span> |
| extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a></pre> |
| <div class="block">This performs union operations for all HllSketches. This union operator can be configured to be |
| on or off heap. The source sketch given to this union using the <a href="#update(org.apache.datasketches.hll.HllSketch)"><code>update(HllSketch)</code></a> can |
| be configured with any precision value <i>lgConfigK</i> (from 4 to 21), any <i>TgtHllType</i> |
| (HLL_4, HLL_6, HLL_8), and either on or off-heap; and it can be in either of the sparse modes |
| (<i>LIST</i> or <i>SET</i>), or the dense mode (<i>HLL</i>). |
| |
| <p>Although the API for this union operator parallels many of the methods of the |
| <i>HllSketch</i>, the behavior of the union operator has some fundamental differences.</p> |
| |
| <p>First, this union operator is configured with a <i>lgMaxK</i> instead of the normal |
| <i>lgConfigK</i>. Generally, this union operator will inherit the lowest <i>lgConfigK</i> |
| less than <i>lgMaxK</i> that it has seen. However, the <i>lgConfigK</i> of incoming sketches that |
| are still in sparse are ignored. The <i>lgMaxK</i> provides the user the ability to specify the |
| largest maximum size for the union operation. |
| |
| <p>Second, the user cannot specify the <a href="TgtHllType.html" title="enum in org.apache.datasketches.hll"><code>TgtHllType</code></a> as an input parameter to the union. |
| Instead, it is specified for the sketch returned with <a href="#getResult(org.apache.datasketches.hll.TgtHllType)"><code>getResult(TgtHllType)</code></a>. |
| |
| <p>The following graph illustrates the HLL Merge speed.</p> |
| |
| <p><img src="doc-files/HLL_UnionTime4_6_8_Java_CPP.png" width="500" alt="HLL LgK12 Union Speed"></p> |
| This graph illustrates the relative merging speed of the HLL 4,6,8 Java HLL sketches compared to |
| the DataSketches C++ implementations of the same sketches. With this particular test (merging 32 relative large |
| sketches together), the Java HLL 8 is the fastest and the Java HLL 4 the slowest, with a mixed cluster in the middle. |
| Union / Merging speed is somewhat difficult to measure as the performance is very dependent on the mix of sketch |
| sizes (and types) you are merging. So your mileage will vary! |
| |
| <p>For a complete example of using the Union operator |
| see <a href="https://datasketches.apache.org/docs/HLL/HllJavaExample.html">Union Example</a>.</p></div> |
| <dl> |
| <dt><span class="simpleTagLabel">Author:</span></dt> |
| <dd>Lee Rhodes, Kevin Lang</dd> |
| </dl> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ======== CONSTRUCTOR SUMMARY ======== --> |
| <section> |
| <ul class="blockList"> |
| <li class="blockList"><a id="constructor.summary"> |
| <!-- --> |
| </a> |
| <h3>Constructor Summary</h3> |
| <table class="memberSummary"> |
| <caption><span>Constructors</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Constructor</th> |
| <th class="colLast" scope="col">Description</th> |
| </tr> |
| <tr class="altColor"> |
| <th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E()">Union</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Construct this Union operator with the default maximum log-base-2 of <i>K</i>.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(int)">Union</a></span>​(int lgMaxK)</code></th> |
| <td class="colLast"> |
| <div class="block">Construct this Union operator with a given maximum log-base-2 of <i>K</i>.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(int,org.apache.datasketches.memory.WritableMemory)">Union</a></span>​(int lgMaxK, |
| org.apache.datasketches.memory.WritableMemory dstWmem)</code></th> |
| <td class="colLast"> |
| <div class="block">Construct this Union operator with a given maximum log-base-2 of <i>K</i> and the given |
| WritableMemory as the destination for this Union.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| </section> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <section> |
| <ul class="blockList"> |
| <li class="blockList"><a id="method.summary"> |
| <!-- --> |
| </a> |
| <h3>Method Summary</h3> |
| <table class="memberSummary"> |
| <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colSecond" scope="col">Method</th> |
| <th class="colLast" scope="col">Description</th> |
| </tr> |
| <tr id="i0" class="altColor"> |
| <td class="colFirst"><code>int</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getCompactSerializationBytes()">getCompactSerializationBytes</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Gets the size in bytes of the current sketch when serialized using |
| <i>toCompactByteArray()</i>.</div> |
| </td> |
| </tr> |
| <tr id="i1" class="rowColor"> |
| <td class="colFirst"><code>double</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getCompositeEstimate()">getCompositeEstimate</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">This is less accurate than the <i>getEstimate()</i> method and is automatically used |
| when the sketch has gone through union operations where the more accurate HIP estimator |
| cannot be used.</div> |
| </td> |
| </tr> |
| <tr id="i2" class="altColor"> |
| <td class="colFirst"><code>double</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getEstimate()">getEstimate</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Return the cardinality estimate</div> |
| </td> |
| </tr> |
| <tr id="i3" class="rowColor"> |
| <td class="colFirst"><code>int</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getLgConfigK()">getLgConfigK</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Gets the effective <i>lgConfigK</i> for the union operator, which may be less than |
| <i>lgMaxK</i>.</div> |
| </td> |
| </tr> |
| <tr id="i4" class="altColor"> |
| <td class="colFirst"><code>double</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getLowerBound(int)">getLowerBound</a></span>​(int numStdDev)</code></th> |
| <td class="colLast"> |
| <div class="block">Gets the approximate lower error bound given the specified number of Standard Deviations.</div> |
| </td> |
| </tr> |
| <tr id="i5" class="rowColor"> |
| <td class="colFirst"><code>static int</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMaxSerializationBytes(int)">getMaxSerializationBytes</a></span>​(int lgK)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the maximum size in bytes that this union operator can grow to given a lgK.</div> |
| </td> |
| </tr> |
| <tr id="i6" class="altColor"> |
| <td class="colFirst"><code>static double</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getRelErr(boolean,boolean,int,int)">getRelErr</a></span>​(boolean upperBound, |
| boolean oooFlag, |
| int lgConfigK, |
| int numStdDev)</code></th> |
| <td class="colLast"> |
| <div class="block">Gets the current (approximate) Relative Error (RE) asymptotic values given several |
| parameters.</div> |
| </td> |
| </tr> |
| <tr id="i7" class="rowColor"> |
| <td class="colFirst"><code><a href="HllSketch.html" title="class in org.apache.datasketches.hll">HllSketch</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getResult()">getResult</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Return the result of this union operator as an HLL_4 sketch.</div> |
| </td> |
| </tr> |
| <tr id="i8" class="altColor"> |
| <td class="colFirst"><code><a href="HllSketch.html" title="class in org.apache.datasketches.hll">HllSketch</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getResult(org.apache.datasketches.hll.TgtHllType)">getResult</a></span>​(<a href="TgtHllType.html" title="enum in org.apache.datasketches.hll">TgtHllType</a> tgtHllType)</code></th> |
| <td class="colLast"> |
| <div class="block">Return the result of this union operator with the specified <a href="TgtHllType.html" title="enum in org.apache.datasketches.hll"><code>TgtHllType</code></a></div> |
| </td> |
| </tr> |
| <tr id="i9" class="rowColor"> |
| <td class="colFirst"><code>static int</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getSerializationVersion()">getSerializationVersion</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the current serialization version.</div> |
| </td> |
| </tr> |
| <tr id="i10" class="altColor"> |
| <td class="colFirst"><code>static int</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getSerializationVersion(org.apache.datasketches.memory.Memory)">getSerializationVersion</a></span>​(org.apache.datasketches.memory.Memory mem)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the current serialization version of the given Memory.</div> |
| </td> |
| </tr> |
| <tr id="i11" class="rowColor"> |
| <td class="colFirst"><code><a href="TgtHllType.html" title="enum in org.apache.datasketches.hll">TgtHllType</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getTgtHllType()">getTgtHllType</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Gets the <a href="TgtHllType.html" title="enum in org.apache.datasketches.hll"><code>TgtHllType</code></a></div> |
| </td> |
| </tr> |
| <tr id="i12" class="altColor"> |
| <td class="colFirst"><code>int</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getUpdatableSerializationBytes()">getUpdatableSerializationBytes</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Gets the size in bytes of the current sketch when serialized using |
| <i>toUpdatableByteArray()</i>.</div> |
| </td> |
| </tr> |
| <tr id="i13" class="rowColor"> |
| <td class="colFirst"><code>double</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getUpperBound(int)">getUpperBound</a></span>​(int numStdDev)</code></th> |
| <td class="colLast"> |
| <div class="block">Gets the approximate upper error bound given the specified number of Standard Deviations.</div> |
| </td> |
| </tr> |
| <tr id="i14" class="altColor"> |
| <td class="colFirst"><code>static <a href="Union.html" title="class in org.apache.datasketches.hll">Union</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#heapify(byte%5B%5D)">heapify</a></span>​(byte[] byteArray)</code></th> |
| <td class="colLast"> |
| <div class="block">Construct a union operator populated with the given byte array image of an HllSketch.</div> |
| </td> |
| </tr> |
| <tr id="i15" class="rowColor"> |
| <td class="colFirst"><code>static <a href="Union.html" title="class in org.apache.datasketches.hll">Union</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#heapify(org.apache.datasketches.memory.Memory)">heapify</a></span>​(org.apache.datasketches.memory.Memory mem)</code></th> |
| <td class="colLast"> |
| <div class="block">Construct a union operator populated with the given Memory image of an HllSketch.</div> |
| </td> |
| </tr> |
| <tr id="i16" class="altColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isCompact()">isCompact</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Returns true if the backing memory of this sketch is in compact form.</div> |
| </td> |
| </tr> |
| <tr id="i17" class="rowColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isEmpty()">isEmpty</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Returns true if empty</div> |
| </td> |
| </tr> |
| <tr id="i18" class="altColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isEstimationMode()">isEstimationMode</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">This HLL family of sketches and operators is always estimating, even for very small values.</div> |
| </td> |
| </tr> |
| <tr id="i19" class="rowColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isMemory()">isMemory</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Returns true if this sketch was created using Memory.</div> |
| </td> |
| </tr> |
| <tr id="i20" class="altColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isOffHeap()">isOffHeap</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Returns true if the backing memory for this sketch is off-heap.</div> |
| </td> |
| </tr> |
| <tr id="i21" class="rowColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isSameResource(org.apache.datasketches.memory.Memory)">isSameResource</a></span>​(org.apache.datasketches.memory.Memory mem)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns true if the given Memory refers to the same underlying resource as this sketch.</div> |
| </td> |
| </tr> |
| <tr id="i22" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#reset()">reset</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Resets to empty and retains the current lgK, but does not change the configured value of |
| lgMaxK.</div> |
| </td> |
| </tr> |
| <tr id="i23" class="rowColor"> |
| <td class="colFirst"><code>byte[]</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toCompactByteArray()">toCompactByteArray</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Gets the serialization of this union operator as a byte array in compact form, which is |
| designed to be heapified only.</div> |
| </td> |
| </tr> |
| <tr id="i24" class="altColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toString()">toString</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Human readable summary as a string.</div> |
| </td> |
| </tr> |
| <tr id="i25" class="rowColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toString(boolean,boolean,boolean)">toString</a></span>​(boolean summary, |
| boolean detail, |
| boolean auxDetail)</code></th> |
| <td class="colLast"> |
| <div class="block">Human readable summary with optional detail.</div> |
| </td> |
| </tr> |
| <tr id="i26" class="altColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toString(boolean,boolean,boolean,boolean)">toString</a></span>​(boolean summary, |
| boolean hllDetail, |
| boolean auxDetail, |
| boolean all)</code></th> |
| <td class="colLast"> |
| <div class="block">Human readable summary with optional detail</div> |
| </td> |
| </tr> |
| <tr id="i27" class="rowColor"> |
| <td class="colFirst"><code>byte[]</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toUpdatableByteArray()">toUpdatableByteArray</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Serializes this sketch as a byte array in an updatable form.</div> |
| </td> |
| </tr> |
| <tr id="i28" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#update(byte%5B%5D)">update</a></span>​(byte[] data)</code></th> |
| <td class="colLast"> |
| <div class="block">Present the given byte array as a potential unique item.</div> |
| </td> |
| </tr> |
| <tr id="i29" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#update(char%5B%5D)">update</a></span>​(char[] data)</code></th> |
| <td class="colLast"> |
| <div class="block">Present the given char array as a potential unique item.</div> |
| </td> |
| </tr> |
| <tr id="i30" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#update(double)">update</a></span>​(double datum)</code></th> |
| <td class="colLast"> |
| <div class="block">Present the given double (or float) datum as a potential unique item.</div> |
| </td> |
| </tr> |
| <tr id="i31" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#update(int%5B%5D)">update</a></span>​(int[] data)</code></th> |
| <td class="colLast"> |
| <div class="block">Present the given integer array as a potential unique item.</div> |
| </td> |
| </tr> |
| <tr id="i32" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#update(long)">update</a></span>​(long datum)</code></th> |
| <td class="colLast"> |
| <div class="block">Present the given long as a potential unique item.</div> |
| </td> |
| </tr> |
| <tr id="i33" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#update(long%5B%5D)">update</a></span>​(long[] data)</code></th> |
| <td class="colLast"> |
| <div class="block">Present the given long array as a potential unique item.</div> |
| </td> |
| </tr> |
| <tr id="i34" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#update(java.lang.String)">update</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> datum)</code></th> |
| <td class="colLast"> |
| <div class="block">Present the given String as a potential unique item.</div> |
| </td> |
| </tr> |
| <tr id="i35" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#update(java.nio.ByteBuffer)">update</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio" class="externalLink">ByteBuffer</a> data)</code></th> |
| <td class="colLast"> |
| <div class="block">Present the given byte buffer as a potential unique item.</div> |
| </td> |
| </tr> |
| <tr id="i36" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#update(org.apache.datasketches.hll.HllSketch)">update</a></span>​(<a href="HllSketch.html" title="class in org.apache.datasketches.hll">HllSketch</a> sketch)</code></th> |
| <td class="colLast"> |
| <div class="block">Update this union operator with the given sketch.</div> |
| </td> |
| </tr> |
| <tr id="i37" class="rowColor"> |
| <td class="colFirst"><code>static <a href="Union.html" title="class in org.apache.datasketches.hll">Union</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#writableWrap(org.apache.datasketches.memory.WritableMemory)">writableWrap</a></span>​(org.apache.datasketches.memory.WritableMemory srcWmem)</code></th> |
| <td class="colLast"> |
| <div class="block">Wraps the given WritableMemory, which must be a image of a valid updatable HLL_8 sketch, |
| and may have data.</div> |
| </td> |
| </tr> |
| </table> |
| <ul class="blockList"> |
| <li class="blockList"><a id="methods.inherited.from.class.java.lang.Object"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from class java.lang.<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a></h3> |
| <code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang" class="externalLink">clone</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang" class="externalLink">equals</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang" class="externalLink">finalize</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang" class="externalLink">getClass</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang" class="externalLink">hashCode</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang" class="externalLink">notify</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang" class="externalLink">notifyAll</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang" class="externalLink">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang" class="externalLink">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait(long,int)" title="class or interface in java.lang" class="externalLink">wait</a></code></li> |
| </ul> |
| </li> |
| </ul> |
| </section> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ========= CONSTRUCTOR DETAIL ======== --> |
| <section> |
| <ul class="blockList"> |
| <li class="blockList"><a id="constructor.detail"> |
| <!-- --> |
| </a> |
| <h3>Constructor Detail</h3> |
| <a id="<init>()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>Union</h4> |
| <pre>public Union()</pre> |
| <div class="block">Construct this Union operator with the default maximum log-base-2 of <i>K</i>.</div> |
| </li> |
| </ul> |
| <a id="<init>(int)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>Union</h4> |
| <pre>public Union​(int lgMaxK)</pre> |
| <div class="block">Construct this Union operator with a given maximum log-base-2 of <i>K</i>.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>lgMaxK</code> - the desired maximum log-base-2 of <i>K</i>. This value must be |
| between 4 and 21 inclusively.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="<init>(int,org.apache.datasketches.memory.WritableMemory)"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>Union</h4> |
| <pre>public Union​(int lgMaxK, |
| org.apache.datasketches.memory.WritableMemory dstWmem)</pre> |
| <div class="block">Construct this Union operator with a given maximum log-base-2 of <i>K</i> and the given |
| WritableMemory as the destination for this Union. This WritableMemory is usually configured |
| for off-heap memory. What remains on the java heap is a thin wrapper object that reads and |
| writes to the given WritableMemory. |
| |
| <p>The given <i>dstMem</i> is checked for the required capacity as determined by |
| <a href="HllSketch.html#getMaxUpdatableSerializationBytes(int,org.apache.datasketches.hll.TgtHllType)"><code>HllSketch.getMaxUpdatableSerializationBytes(int, TgtHllType)</code></a>.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>lgMaxK</code> - the desired maximum log-base-2 of <i>K</i>. This value must be |
| between 4 and 21 inclusively.</dd> |
| <dd><code>dstWmem</code> - the destination writable memory for the sketch.</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </section> |
| <!-- ============ METHOD DETAIL ========== --> |
| <section> |
| <ul class="blockList"> |
| <li class="blockList"><a id="method.detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a id="heapify(byte[])"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>heapify</h4> |
| <pre class="methodSignature">public static final <a href="Union.html" title="class in org.apache.datasketches.hll">Union</a> heapify​(byte[] byteArray)</pre> |
| <div class="block">Construct a union operator populated with the given byte array image of an HllSketch.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>byteArray</code> - the given byte array</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a union operator populated with the given byte array image of an HllSketch.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="heapify(org.apache.datasketches.memory.Memory)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>heapify</h4> |
| <pre class="methodSignature">public static final <a href="Union.html" title="class in org.apache.datasketches.hll">Union</a> heapify​(org.apache.datasketches.memory.Memory mem)</pre> |
| <div class="block">Construct a union operator populated with the given Memory image of an HllSketch.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>mem</code> - the given Memory</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a union operator populated with the given Memory image of an HllSketch.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="writableWrap(org.apache.datasketches.memory.WritableMemory)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>writableWrap</h4> |
| <pre class="methodSignature">public static final <a href="Union.html" title="class in org.apache.datasketches.hll">Union</a> writableWrap​(org.apache.datasketches.memory.WritableMemory srcWmem)</pre> |
| <div class="block">Wraps the given WritableMemory, which must be a image of a valid updatable HLL_8 sketch, |
| and may have data. What remains on the java heap is a |
| thin wrapper object that reads and writes to the given WritableMemory, which, depending on |
| how the user configures the WritableMemory, may actually reside on the Java heap or off-heap. |
| |
| <p>The given <i>dstMem</i> is checked for the required capacity as determined by |
| <a href="HllSketch.html#getMaxUpdatableSerializationBytes(int,org.apache.datasketches.hll.TgtHllType)"><code>HllSketch.getMaxUpdatableSerializationBytes(int, TgtHllType)</code></a>, and for the correct type.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>srcWmem</code> - an writable image of a valid sketch with data.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a Union operator where the sketch data is in the given dstMem.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getCompositeEstimate()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getCompositeEstimate</h4> |
| <pre class="methodSignature">public double getCompositeEstimate()</pre> |
| <div class="block">This is less accurate than the <i>getEstimate()</i> method and is automatically used |
| when the sketch has gone through union operations where the more accurate HIP estimator |
| cannot be used. |
| This is made public only for error characterization software that exists in separate |
| packages and is not intended for normal use.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the composite estimate</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getCompactSerializationBytes()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getCompactSerializationBytes</h4> |
| <pre class="methodSignature">public int getCompactSerializationBytes()</pre> |
| <div class="block">Gets the size in bytes of the current sketch when serialized using |
| <i>toCompactByteArray()</i>.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the size in bytes of the current sketch when serialized using |
| <i>toCompactByteArray()</i>.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getEstimate()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getEstimate</h4> |
| <pre class="methodSignature">public double getEstimate()</pre> |
| <div class="block">Return the cardinality estimate</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the cardinality estimate</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getLgConfigK()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getLgConfigK</h4> |
| <pre class="methodSignature">public int getLgConfigK()</pre> |
| <div class="block">Gets the effective <i>lgConfigK</i> for the union operator, which may be less than |
| <i>lgMaxK</i>.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the <i>lgConfigK</i>.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getLowerBound(int)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getLowerBound</h4> |
| <pre class="methodSignature">public double getLowerBound​(int numStdDev)</pre> |
| <div class="block">Gets the approximate lower error bound given the specified number of Standard Deviations.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>numStdDev</code> - This must be an integer between 1 and 3, inclusive. |
| <a href="../../../../resources/dictionary.html#numStdDev">See Number of Standard Deviations</a></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the lower bound.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getMaxSerializationBytes(int)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getMaxSerializationBytes</h4> |
| <pre class="methodSignature">public static int getMaxSerializationBytes​(int lgK)</pre> |
| <div class="block">Returns the maximum size in bytes that this union operator can grow to given a lgK.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>lgK</code> - The maximum Log2 of K for this union operator. This value must be |
| between 4 and 21 inclusively.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the maximum size in bytes that this union operator can grow to.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getResult()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getResult</h4> |
| <pre class="methodSignature">public <a href="HllSketch.html" title="class in org.apache.datasketches.hll">HllSketch</a> getResult()</pre> |
| <div class="block">Return the result of this union operator as an HLL_4 sketch.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the result of this union operator as an HLL_4 sketch.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getResult(org.apache.datasketches.hll.TgtHllType)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getResult</h4> |
| <pre class="methodSignature">public <a href="HllSketch.html" title="class in org.apache.datasketches.hll">HllSketch</a> getResult​(<a href="TgtHllType.html" title="enum in org.apache.datasketches.hll">TgtHllType</a> tgtHllType)</pre> |
| <div class="block">Return the result of this union operator with the specified <a href="TgtHllType.html" title="enum in org.apache.datasketches.hll"><code>TgtHllType</code></a></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>tgtHllType</code> - the TgtHllType enum</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the result of this union operator with the specified TgtHllType</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getTgtHllType()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getTgtHllType</h4> |
| <pre class="methodSignature">public <a href="TgtHllType.html" title="enum in org.apache.datasketches.hll">TgtHllType</a> getTgtHllType()</pre> |
| <div class="block">Gets the <a href="TgtHllType.html" title="enum in org.apache.datasketches.hll"><code>TgtHllType</code></a></div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the TgtHllType enum value</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getUpdatableSerializationBytes()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getUpdatableSerializationBytes</h4> |
| <pre class="methodSignature">public int getUpdatableSerializationBytes()</pre> |
| <div class="block">Gets the size in bytes of the current sketch when serialized using |
| <i>toUpdatableByteArray()</i>.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the size in bytes of the current sketch when serialized using |
| <i>toUpdatableByteArray()</i>.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getUpperBound(int)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getUpperBound</h4> |
| <pre class="methodSignature">public double getUpperBound​(int numStdDev)</pre> |
| <div class="block">Gets the approximate upper error bound given the specified number of Standard Deviations.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>numStdDev</code> - This must be an integer between 1 and 3, inclusive. |
| <a href="../../../../resources/dictionary.html#numStdDev">Number of Standard Deviations</a></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the upper bound.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="isCompact()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isCompact</h4> |
| <pre class="methodSignature">public boolean isCompact()</pre> |
| <div class="block">Returns true if the backing memory of this sketch is in compact form.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>true if the backing memory of this sketch is in compact form.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="isEmpty()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isEmpty</h4> |
| <pre class="methodSignature">public boolean isEmpty()</pre> |
| <div class="block">Returns true if empty</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>true if empty</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="isMemory()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isMemory</h4> |
| <pre class="methodSignature">public boolean isMemory()</pre> |
| <div class="block">Returns true if this sketch was created using Memory.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>true if this sketch was created using Memory.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="isOffHeap()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isOffHeap</h4> |
| <pre class="methodSignature">public boolean isOffHeap()</pre> |
| <div class="block">Returns true if the backing memory for this sketch is off-heap.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>true if the backing memory for this sketch is off-heap.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="isSameResource(org.apache.datasketches.memory.Memory)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isSameResource</h4> |
| <pre class="methodSignature">public boolean isSameResource​(org.apache.datasketches.memory.Memory mem)</pre> |
| <div class="block">Returns true if the given Memory refers to the same underlying resource as this sketch. |
| The capacities must be the same. If <i>this</i> is a region, |
| the region offset must also be the same. |
| |
| <p>This is only relevant for HLL_4 sketches that have been configured for off-heap |
| using WritableMemory or Memory. For on-heap sketches or unions this will return false. |
| |
| <p>It is rare, but possible, the the off-heap memory that has been allocated to an HLL_4 |
| sketch may not be large enough. If this should happen, the sketch makes a request for more |
| memory from the owner of the resource and then moves itself to this new location. This all |
| happens transparently to the user. This method provides a means for the user to |
| inquire of the sketch if it has, in fact, moved itself.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>mem</code> - the given Memory</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>true if the given Memory refers to the same underlying resource as this sketch or |
| union.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="reset()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>reset</h4> |
| <pre class="methodSignature">public void reset()</pre> |
| <div class="block">Resets to empty and retains the current lgK, but does not change the configured value of |
| lgMaxK.</div> |
| </li> |
| </ul> |
| <a id="toCompactByteArray()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>toCompactByteArray</h4> |
| <pre class="methodSignature">public byte[] toCompactByteArray()</pre> |
| <div class="block">Gets the serialization of this union operator as a byte array in compact form, which is |
| designed to be heapified only. It is not directly updatable. |
| For the Union operator, this is the serialization of the internal state of |
| the union operator as a sketch.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the serialization of this union operator as a byte array.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="toUpdatableByteArray()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>toUpdatableByteArray</h4> |
| <pre class="methodSignature">public byte[] toUpdatableByteArray()</pre> |
| <div class="block">Serializes this sketch as a byte array in an updatable form. The updatable form is larger than |
| the compact form. The use of this form is primarily in environments that support updating |
| sketches in off-heap memory. If the sketch is constructed using HLL_8, sketch updating and |
| union updating operations can actually occur in WritableMemory, which can be off-heap: |
| <pre><code> |
| Union union; HllSketch sk; |
| int lgK = 12; |
| sk = new HllSketch(lgK, TgtHllType.HLL_8) //must be 8 |
| for (int i = 0; i < (2 << lgK); i++) { sk.update(i); } |
| byte[] arr = sk.toUpdatableByteArray(); |
| WritableMemory wmem = WritableMemory.wrap(arr); |
| //... |
| union = Union.writableWrap(wmem); //no deserialization! |
| </code></pre></div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>this sketch as an updatable byte array.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="toString(boolean,boolean,boolean,boolean)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>toString</h4> |
| <pre class="methodSignature">public <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> toString​(boolean summary, |
| boolean hllDetail, |
| boolean auxDetail, |
| boolean all)</pre> |
| <div class="block">Human readable summary with optional detail</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>summary</code> - if true, output the sketch summary</dd> |
| <dd><code>hllDetail</code> - if true, output the internal data array</dd> |
| <dd><code>auxDetail</code> - if true, output the internal Aux array, if it exists.</dd> |
| <dd><code>all</code> - if true, outputs all entries including empty ones</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>human readable string with optional detail.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="update(org.apache.datasketches.hll.HllSketch)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>update</h4> |
| <pre class="methodSignature">public void update​(<a href="HllSketch.html" title="class in org.apache.datasketches.hll">HllSketch</a> sketch)</pre> |
| <div class="block">Update this union operator with the given sketch.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>sketch</code> - the given sketch.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getSerializationVersion()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getSerializationVersion</h4> |
| <pre class="methodSignature">public static final int getSerializationVersion()</pre> |
| <div class="block">Returns the current serialization version.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the current serialization version.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getSerializationVersion(org.apache.datasketches.memory.Memory)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getSerializationVersion</h4> |
| <pre class="methodSignature">public static final int getSerializationVersion​(org.apache.datasketches.memory.Memory mem)</pre> |
| <div class="block">Returns the current serialization version of the given Memory.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>mem</code> - the given Memory containing a serialized HllSketch image.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the current serialization version.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getRelErr(boolean,boolean,int,int)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getRelErr</h4> |
| <pre class="methodSignature">public static double getRelErr​(boolean upperBound, |
| boolean oooFlag, |
| int lgConfigK, |
| int numStdDev)</pre> |
| <div class="block">Gets the current (approximate) Relative Error (RE) asymptotic values given several |
| parameters. This is used primarily for testing.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>upperBound</code> - return the RE for the Upper Bound, otherwise for the Lower Bound.</dd> |
| <dd><code>oooFlag</code> - set true if the sketch is the result of a non qualifying union operation.</dd> |
| <dd><code>lgConfigK</code> - the configured value for the sketch.</dd> |
| <dd><code>numStdDev</code> - the given number of Standard Deviations. This must be an integer between |
| 1 and 3, inclusive. |
| <a href="../../../../resources/dictionary.html#numStdDev">Number of Standard Deviations</a></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the current (approximate) RelativeError</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="isEstimationMode()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isEstimationMode</h4> |
| <pre class="methodSignature">public boolean isEstimationMode()</pre> |
| <div class="block">This HLL family of sketches and operators is always estimating, even for very small values.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>true</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="toString()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>toString</h4> |
| <pre class="methodSignature">public <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> toString()</pre> |
| <div class="block">Human readable summary as a string.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang" class="externalLink">toString</a></code> in class <code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>Human readable summary as a string.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="toString(boolean,boolean,boolean)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>toString</h4> |
| <pre class="methodSignature">public <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> toString​(boolean summary, |
| boolean detail, |
| boolean auxDetail)</pre> |
| <div class="block">Human readable summary with optional detail. Does not list empty entries.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>summary</code> - if true, output the sketch summary</dd> |
| <dd><code>detail</code> - if true, output the internal data array</dd> |
| <dd><code>auxDetail</code> - if true, output the internal Aux array, if it exists.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>human readable string with optional detail.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="update(long)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>update</h4> |
| <pre class="methodSignature">public void update​(long datum)</pre> |
| <div class="block">Present the given long as a potential unique item.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>datum</code> - The given long datum.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="update(double)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>update</h4> |
| <pre class="methodSignature">public void update​(double datum)</pre> |
| <div class="block">Present the given double (or float) datum as a potential unique item. |
| The double will be converted to a long using Double.doubleToLongBits(datum), |
| which normalizes all NaN values to a single NaN representation. |
| Plus and minus zero will be normalized to plus zero. |
| The special floating-point values NaN and +/- Infinity are treated as distinct.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>datum</code> - The given double datum.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="update(java.lang.String)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>update</h4> |
| <pre class="methodSignature">public void update​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> datum)</pre> |
| <div class="block">Present the given String as a potential unique item. |
| The string is converted to a byte array using UTF8 encoding. |
| If the string is null or empty no update attempt is made and the method returns. |
| |
| <p>Note: About 2X faster performance can be obtained by first converting the String to a |
| char[] and updating the sketch with that. This bypasses the complexity of the Java UTF_8 |
| encoding. This, of course, will not produce the same internal hash values as updating directly |
| with a String. So be consistent! Unioning two sketches, one fed with strings and the other |
| fed with char[] will be meaningless. |
| </p></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>datum</code> - The given String.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="update(java.nio.ByteBuffer)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>update</h4> |
| <pre class="methodSignature">public void update​(<a href="https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio" class="externalLink">ByteBuffer</a> data)</pre> |
| <div class="block">Present the given byte buffer as a potential unique item. |
| Bytes are read from the current position of the buffer until its limit. |
| If the byte buffer is null or has no bytes remaining, no update attempt is made and the method returns. |
| |
| <p>This method will not modify the position, mark, limit, or byte order of the buffer.</p> |
| |
| <p>Little-endian order is preferred, but not required. This method may perform better if the provided byte |
| buffer is in little-endian order.</p></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>data</code> - The given byte buffer.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="update(byte[])"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>update</h4> |
| <pre class="methodSignature">public void update​(byte[] data)</pre> |
| <div class="block">Present the given byte array as a potential unique item. |
| If the byte array is null or empty no update attempt is made and the method returns.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>data</code> - The given byte array.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="update(char[])"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>update</h4> |
| <pre class="methodSignature">public void update​(char[] data)</pre> |
| <div class="block">Present the given char array as a potential unique item. |
| If the char array is null or empty no update attempt is made and the method returns. |
| |
| <p>Note: this will not produce the same output hash values as the <i>update(String)</i> |
| method but will be a little faster as it avoids the complexity of the UTF8 encoding.</p></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>data</code> - The given char array.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="update(int[])"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>update</h4> |
| <pre class="methodSignature">public void update​(int[] data)</pre> |
| <div class="block">Present the given integer array as a potential unique item. |
| If the integer array is null or empty no update attempt is made and the method returns.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>data</code> - The given int array.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="update(long[])"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>update</h4> |
| <pre class="methodSignature">public void update​(long[] data)</pre> |
| <div class="block">Present the given long array as a potential unique item. |
| If the long array is null or empty no update attempt is made and the method returns.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>data</code> - The given long array.</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </section> |
| </li> |
| </ul> |
| </div> |
| </div> |
| </main> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <footer role="contentinfo"> |
| <nav role="navigation"> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a id="navbar.bottom"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <a id="navbar.bottom.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../index.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/Union.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../../../allclasses.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a id="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| </nav> |
| <p class="legalCopy"><small>Copyright © 2015–2022 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p> |
| </footer> |
| </body> |
| </html> |