blob: 3fac9a46cc35fe8fc05beed2ea5c4a21555aca7a [file] [log] [blame]
<!DOCTYPE html>
<!-- Start _layouts/doc_page.html-->
<html lang="en">
<head>
<!-- Start _include/site_head.html -->
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="datasketches">
<title>DataSketches | </title>
<link rel="shortcut icon" href="/img/favicon.png">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link href='https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300,700,300italic|Open+Sans:300italic,400italic,600italic,400,300,600'
rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="/css/main.css">
<link rel="stylesheet" href="/css/header.css">
<link rel="stylesheet" href="/css/footer.css">
<link rel="stylesheet" href="/css/syntax.css">
<link rel="stylesheet" href="/css/docs.css">
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML-full">
</script>
<script src="https://code.jquery.com/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<!-- End _include/site_head.html -->
</head>
<body>
<!-- Start _include/nav_bar.html -->
<div class="navbar navbar-inverse navbar-static-top ds-nav">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="/" style="padding-top: 0px; padding-bottom: 0px;">
<span class="ds-small-h-logo"></span></a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li>
<a href="/docs/Background/TheChallenge.html">
<span class="fa fa-info-circle"></span> DOCUMENTATION</a>
</li>
<li>
<a href="/docs/Community/Downloads.html">
<span class="fa fa-download"></span> DOWNLOAD</a>
</li>
<!--
<li>
<a href="/docs/Architecture/Components.html">
<span class="fa fa-github"></span> GITHUB</a>
</li>
-->
<li>
<a href="/docs/Community/Research.html">
<span class="fa fa-paper-plane"></span> RESEARCH</a>
</li>
<li>
<a href="/docs/Community/index.html" style="padding-top: 0; padding-bottom: 0;">
<img class="ds-small-man" src="/img/datasketches-ManWhite.svg"/>COMMUNITY</a>
</li>
<li>
<ul class="nav navbar-nav navbar-right ds-nav">
<li class="dropdown ds-nav" >
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" style="padding-top: 0; padding-bottom: 0;"><img class="apache-logo" src="/img/feather.svg"/>Apache <span class="caret"></span></a>
<ul class="dropdown-menu ds-nav">
<li><a href="https://www.apache.org/" target="_blank">Foundation</a></li>
<li><a href="https://www.apache.org/events/current-event" target="_blank">Events</a></li>
<li><a href="https://www.apache.org/licenses/" target="_blank">License</a></li>
<li><a href="https://www.apache.org/foundation/thanks.html" target="_blank">Thanks</a></li>
<li><a href="https://www.apache.org/security/" target="_blank">Security</a></li>
<li><a href="https://www.apache.org/foundation/sponsorship.html" target="_blank">Sponsorship</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
</div>
<!-- End _include/nav_bar.html -->
<!-- Start _include/javadocs.html -->
<div class="ds-header">
<div class="container">
<h4>API Snapshots:
<a href="/api/java/snapshot/apidocs/index.html">Java Core</a>,
<a href="/api/memory/snapshot/apidocs/index.html">Memory</a>,
<a href="/api/pig/snapshot/apidocs/index.html">Pig</a>,
<a href="/api/hive/snapshot/apidocs/index.html">Hive</a>,
</h4>
</div>
</div>
<!-- End _include/javadocs.html -->
<div class="container">
<div class="row">
<!-- Start ToC Block -->
<div class="col-md-3">
<div class="searchbox" style="position:relative">
<gcse:searchbox-only></gcse:searchbox-only>
</div>
<!-- Start _includes/toc.html -->
<!-- Computer Generated File, Do Not Edit! -->
<link rel="stylesheet" href="/css/toc.css">
<div id="toc" class="nav toc hidden-print">
<p id="background">
<a data-toggle="collapse" class="menu collapsed" href="#collapse_background">Background</a>
</p>
<div class="collapse" id="collapse_background">
<li><a href="/docs/Background/TheChallenge.html">•The Challenge</a></li>
<li><a href="/docs/Background/SketchOrigins.html">•Sketch Origins</a></li>
<li><a href="/docs/Background/SketchElements.html">•Sketch Elements</a></li>
<li><a href="/docs/Background/Presentations.html">•Presentations</a></li>
<li><a href="https://github.com/apache/datasketches-website/tree/master/docs/pdf/DataSketches_deck.pdf">•Overview Slide Deck</a></li>
</div>
<p id="architecture-and-design">
<a data-toggle="collapse" class="menu collapsed" href="#collapse_architecture_and_design">Architecture And Design</a>
</p>
<div class="collapse" id="collapse_architecture_and_design">
<li><a href="/docs/Architecture/MajorSketchFamilies.html">•The Major Sketch Families</a></li>
<li><a href="/docs/Architecture/LargeScale.html">•Large Scale Computing</a></li>
<li><a href="/docs/Architecture/KeyFeatures.html">•Key Features</a></li>
<li><a href="/docs/Architecture/SketchFeaturesMatrix.html">•Sketch Features Matrix</a></li>
<li><a href="/docs/Architecture/Components.html">•Components</a></li>
<li><a href="/docs/Architecture/SketchesByComponent.html">•Sketches by Component</a></li>
<li><a href="/docs/Architecture/SketchCriteria.html">•Sketch Criteria</a></li>
<p id="memory-component">
<a data-toggle="collapse" class="menu collapsed" href="#collapse_memory_component">Memory Component</a>
</p>
<div class="collapse" id="collapse_memory_component">
<li><a href="/docs/Memory/MemoryComponent.html">•Memory Componet</a></li>
<li><a href="/docs/Memory/MemoryPerformance.html">•Memory Component Performance</a></li>
</div>
<li><a href="/docs/Architecture/OrderSensitivity.html">•Notes on Order Sensitivity</a></li>
<li><a href="/docs/Architecture/Concurrency.html">•Notes on Concurrency</a></li>
</div>
<p id="sketch-families">
<a data-toggle="collapse" class="menu collapsed" href="#collapse_sketch_families">Sketch Families</a>
</p>
<div class="collapse" id="collapse_sketch_families">
<p id="distinct-counting">
<a data-toggle="collapse" class="menu collapsed" href="#collapse_distinct_counting">Distinct Counting</a>
</p>
<div class="collapse" id="collapse_distinct_counting">
<li><a href="/docs/DistinctCountFeaturesMatrix.html">•Features Matrix</a></li>
<li><a href="/docs/DistinctCountMeritComparisons.html">•Figures-of-Merit Comparison</a></li>
<p id="cpc-sketches">
<a data-toggle="collapse" class="menu collapsed" href="#collapse_cpc_sketches">CPC Sketches</a>
</p>
<div class="collapse" id="collapse_cpc_sketches">
<li><a href="/docs/CPC/CPC.html">•CPC Sketch</a></li>
<li><a href="/docs/CPC/CpcPerformance.html">•CPC Sketch Performance</a></li>
<p id="cpc-examples">
<a data-toggle="collapse" class="menu collapsed" href="#collapse_cpc_examples">CPC Examples</a>
</p>
<div class="collapse" id="collapse_cpc_examples">
<li><a href="/docs/CPC/CpcJavaExample.html">•CPC Sketch Java Example</a></li>
<li><a href="/docs/CPC/CpcCppExample.html">•CPC Sketch C++ Example</a></li>
<li><a href="/docs/CPC/CpcPigExample.html">•CPC Sketch Pig UDFs</a></li>
<li><a href="/docs/CPC/CpcHiveExample.html">•CPC Sketch Hive UDFs</a></li>
</div>
</div>
<p id="hyperloglog-sketches">
<a data-toggle="collapse" class="menu collapsed" href="#collapse_hyperloglog_sketches">HyperLogLog Sketches</a>
</p>
<div class="collapse" id="collapse_hyperloglog_sketches">
<li><a href="/docs/HLL/HLL.html">•HLL Sketch</a></li>
<li><a href="/docs/HLL/HllMap.html">•HLL Map Sketch</a></li>
<p id="hll-examples">
<a data-toggle="collapse" class="menu collapsed" href="#collapse_hll_examples">HLL Examples</a>
</p>
<div class="collapse" id="collapse_hll_examples">
<li><a href="/docs/HLL/HllJavaExample.html">•HLL Sketch Java Example</a></li>
<li><a href="/docs/HLL/HllCppExample.html">•HLL Sketch C++ Example</a></li>
<li><a href="/docs/HLL/HllPigUDFs.html">•HLL Sketch Pig UDFs</a></li>
<li><a href="/docs/HLL/HllHiveUDFs.html">•HLL Sketch Hive UDFs</a></li>
</div>
<p id="hll-studies">
<a data-toggle="collapse" class="menu collapsed" href="#collapse_hll_studies">HLL Studies</a>
</p>
<div class="collapse" id="collapse_hll_studies">
<li><a href="/docs/HLL/HllPerformance.html">•HLL Sketch Performance</a></li>
<li><a href="/docs/HLL/Hll_vs_CS_Hllpp.html">•HLL vs Clearspring HLL++</a></li>
<li><a href="/docs/HLL/HllSketchVsDruidHyperLogLogCollector.html">•HLL Sketch vs Druid HyperLogLogCollector</a></li>
</div>
</div>
<p id="theta-sketches">
<a data-toggle="collapse" class="menu collapsed" href="#collapse_theta_sketches">Theta Sketches</a>
</p>
<div class="collapse" id="collapse_theta_sketches">
<li><a href="/docs/Theta/ThetaSketchFramework.html">•Theta Sketch Framework</a></li>
<p id="theta-examples">
<a data-toggle="collapse" class="menu collapsed" href="#collapse_theta_examples">Theta Examples</a>
</p>
<div class="collapse" id="collapse_theta_examples">
<li><a href="/docs/Theta/ConcurrentThetaSketch.html">•Concurrent Theta Sketch</a></li>
<li><a href="/docs/Theta/ThetaJavaExample.html">•Theta Sketch Java Example</a></li>
<li><a href="/docs/Theta/ThetaSparkExample.html">•Theta Sketch Spark Example</a></li>
<li><a href="/docs/Theta/ThetaPigUDFs.html">•Theta Sketch Pig UDFs</a></li>
<li><a href="/docs/Theta/ThetaHiveUDFs.html">•Theta Sketch Hive UDFs</a></li>
</div>
<p id="kmv-tutorial">
<a data-toggle="collapse" class="menu collapsed" href="#collapse_kmv_tutorial">KMV Tutorial</a>
</p>
<div class="collapse" id="collapse_kmv_tutorial">
<li><a href="/docs/Theta/InverseEstimate.html">•The Inverse Estimate</a></li>
<li><a href="/docs/Theta/KMVempty.html">•Empty Sketch</a></li>
<li><a href="/docs/Theta/KMVfirstEst.html">•First Estimator</a></li>
<li><a href="/docs/Theta/KMVbetterEst.html">•Better Estimator</a></li>
<li><a href="/docs/Theta/KMVrejection.html">•Rejection Rules</a></li>
<li><a href="/docs/Theta/KMVupdateVkth.html">•Update V(kth) Rule</a></li>
</div>
<p id="set-operations-and-p-sampling">
<a data-toggle="collapse" class="menu collapsed" href="#collapse_set_operations_and_p-sampling">Set Operations and P-sampling</a>
</p>
<div class="collapse" id="collapse_set_operations_and_p-sampling">
<li><a href="/docs/Theta/ThetaSketchSetOps.html">•Set Operations</a></li>
<li><a href="/docs/Theta/ThetaSetOpsCornerCases.html">•Model & Test Set Operations</a></li>
<li><a href="/docs/Theta/ThetaPSampling.html"><i>p</i>-Sampling</a></li>
</div>
<p id="accuracy">
<a data-toggle="collapse" class="menu collapsed" href="#collapse_accuracy">Accuracy</a>
</p>
<div class="collapse" id="collapse_accuracy">
<li><a href="/docs/Theta/ThetaAccuracy.html">•Basic Accuracy</a></li>
<li><a href="/docs/Theta/ThetaAccuracyPlots.html">•Accuracy Plots</a></li>
<li><a href="/docs/Theta/ThetaErrorTable.html">•Relative Error Table</a></li>
<li><a href="/docs/Theta/ThetaSketchSetOpsAccuracy.html">•SetOp Accuracy</a></li>
<li><a href="/docs/Theta/AccuracyOfDifferentKUnions.html">•Unions With Different k</a></li>
</div>
<p id="size">
<a data-toggle="collapse" class="menu collapsed" href="#collapse_size">Size</a>
</p>
<div class="collapse" id="collapse_size">
<li><a href="/docs/Theta/ThetaSize.html">•Theta Sketch Size</a></li>
</div>
<p id="speed">
<a data-toggle="collapse" class="menu collapsed" href="#collapse_speed">Speed</a>
</p>
<div class="collapse" id="collapse_speed">
<li><a href="/docs/Theta/ThetaUpdateSpeed.html">•Update Speed</a></li>
<li><a href="/docs/Theta/ThetaMergeSpeed.html">•Merge Speed</a></li>
</div>
<p id="theta-sketch-theory">
<a data-toggle="collapse" class="menu collapsed" href="#collapse_theta_sketch_theory">Theta Sketch Theory</a>
</p>
<div class="collapse" id="collapse_theta_sketch_theory">
<li><a href="https://github.com/apache/datasketches-website/tree/master/docs/pdf/ThetaSketchFramework.pdf">•Theta Sketch Framework (PDF)</a></li>
<li><a href="https://github.com/apache/datasketches-website/tree/master/docs/pdf/ThetaSketchEquations.pdf">•Theta Sketch Equations (PDF)</a></li>
<li><a href="https://github.com/apache/datasketches-website/tree/master/docs/pdf/DataSketches.pdf">•DataSketches (PDF)</a></li>
<li><a href="/docs/Theta/ThetaConfidenceIntervals.html">•Confidence Intervals Notes</a></li>
<li><a href="/docs/Theta/ThetaMergingAlgorithm.html">•Merging Algorithm Notes</a></li>
<li><a href="/docs/Theta/ThetaReferences.html">•Theta References</a></li>
</div>
</div>
<p id="tuple-sketches">
<a data-toggle="collapse" class="menu collapsed" href="#collapse_tuple_sketches">Tuple Sketches</a>
</p>
<div class="collapse" id="collapse_tuple_sketches">
<li><a href="/docs/Tuple/TupleOverview.html">•Tuple Overview</a></li>
<p id="tuple-examples">
<a data-toggle="collapse" class="menu collapsed" href="#collapse_tuple_examples">Tuple Examples</a>
</p>
<div class="collapse" id="collapse_tuple_examples">
<li><a href="/docs/Tuple/TupleJavaExample.html">•Tuple Java Example</a></li>
<li><a href="/docs/Tuple/TupleEngagementExample.html">•Tuple Engagement Example</a></li>
<li><a href="/docs/Tuple/TuplePigUDFs.html">•Tuple Pig UDFs</a></li>
<li><a href="/docs/Tuple/TupleHiveUDFs.html">•Tuple Hive UDFs</a></li>
</div>
</div>
</div>
<p id="most-frequent">
<a data-toggle="collapse" class="menu collapsed" href="#collapse_most_frequent">Most Frequent</a>
</p>
<div class="collapse" id="collapse_most_frequent">
<li><a href="/docs/Frequency/FrequencySketchesOverview.html">•Frequency Sketches Overview</a></li>
<p id="frequent-item-sketches">
<a data-toggle="collapse" class="menu collapsed" href="#collapse_frequent_item_sketches">Frequent Item Sketches</a>
</p>
<div class="collapse" id="collapse_frequent_item_sketches">
<li><a href="/docs/Frequency/FrequentItemsOverview.html">•Frequent Items Overview</a></li>
<li><a href="/docs/Frequency/FrequentItemsErrorTable.html">•Frequent Items Error Table</a></li>
<li><a href="/docs/Frequency/FrequentItemsReferences.html">•Frequent Items References</a></li>
<li><a href="/docs/Frequency/FrequentItemsPerformance.html">•Frequent Items Performance</a></li>
<p id="most-frequent-examples">
<a data-toggle="collapse" class="menu collapsed" href="#collapse_most_frequent_examples">Most Frequent Examples</a>
</p>
<div class="collapse" id="collapse_most_frequent_examples">
<li><a href="/docs/Frequency/FrequentItemsJavaExample.html">•Frequent Items Java Example</a></li>
<li><a href="/docs/Frequency/FrequentItemsCppExample.html">•Frequent Items C++ Example</a></li>
<li><a href="/docs/Frequency/FrequentItemsPigUDFs.html">•Frequent Items Pig UDFs</a></li>
<li><a href="/docs/Frequency/FrequentItemsHiveUDFs.html">•Frequent Items Hive UDFs</a></li>
</div>
</div>
<p id="frequent-distinct-sketches">
<a data-toggle="collapse" class="menu collapsed" href="#collapse_frequent_distinct_sketches">Frequent Distinct Sketches</a>
</p>
<div class="collapse" id="collapse_frequent_distinct_sketches">
<li><a href="/docs/Frequency/FrequentDistinctTuplesSketch.html">•Frequent Distinct Tuples Sketch</a></li>
</div>
</div>
<p id="quantiles-and-histograms">
<a data-toggle="collapse" class="menu collapsed" href="#collapse_quantiles_and_histograms">Quantiles And Histograms</a>
</p>
<div class="collapse" id="collapse_quantiles_and_histograms">
<li><a href="/docs/Quantiles/SketchingQuantilesAndRanksTutorial.html">•Quantiles and Ranks Tutorial</a></li>
<li><a href="/docs/Quantiles/QuantilesOverview.html">•Quantiles Overview</a></li>
<li><a href="/docs/KLL/KLLSketch.html">•KLL Floats sketch</a></li>
<li><a href="/docs/KLL/KLLAccuracyAndSize.html">•KLL Sketch Accuracy and Size</a></li>
<li><a href="/docs/REQ/ReqSketch.html">•REQ Floats sketch</a></li>
<li><a href="/docs/Quantiles/OrigQuantilesSketch.html">•Original QuantilesSketch</a></li>
<p id="quantiles-examples">
<a data-toggle="collapse" class="menu collapsed" href="#collapse_quantiles_examples">Quantiles Examples</a>
</p>
<div class="collapse" id="collapse_quantiles_examples">
<li><a href="/docs/Quantiles/QuantilesJavaExample.html">•Quantiles Sketch Java Example</a></li>
<li><a href="/docs/KLL/KLLCppExample.html">•KLL Quantiles Sketch C++ Example</a></li>
<li><a href="/docs/Quantiles/QuantilesPigUDFs.html">•Quantiles Sketch Pig UDFs</a></li>
<li><a href="/docs/Quantiles/QuantilesHiveUDFs.html">•Quantiles Sketch Hive UDFs</a></li>
</div>
<p id="quantiles-studies">
<a data-toggle="collapse" class="menu collapsed" href="#collapse_quantiles_studies">Quantiles Studies</a>
</p>
<div class="collapse" id="collapse_quantiles_studies">
<li><a href="/docs/QuantilesStudies/KllSketchVsTDigest.html">•KLL sketch vs t-digest</a></li>
<li><a href="/docs/QuantilesStudies/DruidApproxHistogramStudy.html">•Druid Approximate Histogram</a></li>
<li><a href="/docs/QuantilesStudies/MomentsSketchStudy.html">•Moments Sketch Study</a></li>
<li><a href="/docs/QuantilesStudies/QuantilesStreamAStudy.html">•Quantiles StreamA Study</a></li>
<li><a href="/docs/QuantilesStudies/ExactQuantiles.html">•Exact Quantiles for Studies</a></li>
</div>
<p id="quantiles-sketch-theory">
<a data-toggle="collapse" class="menu collapsed" href="#collapse_quantiles_sketch_theory">Quantiles Sketch Theory</a>
</p>
<div class="collapse" id="collapse_quantiles_sketch_theory">
<li><a href="https://github.com/apache/datasketches-website/tree/master/docs/pdf/Quantiles_KLL.pdf">•Optimal Quantile Approximation in Streams</a></li>
<li><a href="/docs/Quantiles/QuantilesReferences.html">•Quantiles References</a></li>
</div>
</div>
<p id="sampling">
<a data-toggle="collapse" class="menu collapsed" href="#collapse_sampling">Sampling</a>
</p>
<div class="collapse" id="collapse_sampling">
<li><a href="/docs/Sampling/ReservoirSampling.html">•Reservoir Sampling</a></li>
<li><a href="/docs/Sampling/ReservoirSamplingPerformance.html">•Reservoir Sampling Performance</a></li>
<li><a href="/docs/Sampling/VarOptSampling.html">•VarOpt Sampling</a></li>
<p id="sampling-examples">
<a data-toggle="collapse" class="menu collapsed" href="#collapse_sampling_examples">Sampling Examples</a>
</p>
<div class="collapse" id="collapse_sampling_examples">
<li><a href="/docs/Sampling/ReservoirSamplingJava.html">•Reservoir Sampling Java Example</a></li>
<li><a href="/docs/Sampling/ReservoirSamplingPigUDFs.html">•Reservoir Sampling Pig UDFs</a></li>
<li><a href="/docs/Sampling/VarOptSamplingJava.html">•VarOpt Sampling Java Example</a></li>
<li><a href="/docs/Sampling/VarOptPigUDFs.html">•VarOpt Sampling Pig UDFs</a></li>
</div>
</div>
</div>
<p id="system-integrations">
<a data-toggle="collapse" class="menu collapsed" href="#collapse_system_integrations">System Integrations</a>
</p>
<div class="collapse" id="collapse_system_integrations">
<li><a href="/docs/SystemIntegrations/ApacheDruidIntegration.html">•Using Sketches in ApacheDruid</a></li>
<li><a href="/docs/SystemIntegrations/ApacheHiveIntegration.html">•Using Sketches in Apache Hive</a></li>
<li><a href="/docs/SystemIntegrations/ApachePigIntegration.html">•Using Sketches in Apache Pig</a></li>
<li><a href="/docs/SystemIntegrations/PostgreSQLIntegration.html">•Using Sketches in PostgreSQL</a></li>
</div>
<p id="community">
<a data-toggle="collapse" class="menu collapsed" href="#collapse_community">Community</a>
</p>
<div class="collapse" id="collapse_community">
<li><a href="/docs/Community/index.html">•Community</a></li>
<li><a href="/docs/Community/Downloads.html">•Downloads</a></li>
<li><a href="/docs/Community/NewCommitterProcess.html">•Committer Process</a></li>
<li><a href="/docs/Community/ReleaseProcessForCppComponents.html">•Release Process For CPP Components</a></li>
<li><a href="/docs/Community/ReleaseProcessForJavaComponents.html">•Release Process For Java Components</a></li>
<li><a href="/docs/Community/Transitioning.html">•Transitioning from prior GitHub Site</a></li>
</div>
<p id="research">
<a data-toggle="collapse" class="menu collapsed" href="#collapse_research">Research</a>
</p>
<div class="collapse" id="collapse_research">
<li><a href="/docs/Community/Research.html">•Research</a></li>
</div>
</div>
<!-- End _includes/toc.html -->
<!-- Start _includes/tocScript.html -->
<script>
(function () {
var findLineItem = function (path) {
return document.querySelector(`#toc [href="${path}"]`);
};
function findNavItem(path) {
return document.querySelector(`.nav [href="${path}"]`);
}
var highlighLineItem = function (element) {
element.classList.add('highlight');
};
var checkHasClass = function (element, className) {
return element.className.split(' ').find(function (item) { return item === className || '' })
}
var findAllCollapseParents = function (element) {
var collapseMenus = [];
var elementPointer = element;
while (elementPointer !== document.body) {
if (checkHasClass(elementPointer, 'collapse')) {
collapseMenus.push(elementPointer);
}
elementPointer = elementPointer.parentElement
}
return collapseMenus
};
var openMenuItem = function (element) {
// $(element).collapse('show') would start a transition, adding `in` class instead.
element.classList.add('in');
};
var openAllFromList = function (elementList) {
elementList.forEach(openMenuItem);
};
var highlightAndOpenMenu = function () {
// Highlight & expand nav item in the TOC
var currentLineItem = findLineItem(document.location.pathname);
highlighLineItem(currentLineItem);
openAllFromList(findAllCollapseParents(currentLineItem));
// Highlight nav item in top navigation
highlighLineItem(findNavItem(document.location.pathname));
};
$(highlightAndOpenMenu);
}());
</script>
<!-- End _includes/tocScript.html -->
</div>
<!-- End ToC Block -->
<div class="col-md-9 doc-content">
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<h1 id="kll-sketch-accuracy-and-size">KLL Sketch Accuracy and Size</h1>
<p>The accuracy of the KLL quantile sketch is a function of the configured <i>K</i>, which also affects the overall size of the sketch (default K = 200).</p>
<p>The accuracy of quantiles sketches is specified and measured with respect to the <em>rank</em> only, not the quantiles.</p>
<p>The KLL Sketch has <em>absolute error</em>. For example, a specified rank accuracy of 1% at the median (rank = 0.50) means that the true quantile (if you could extract it from the set) should be between <em>getQuantile(0.49)</em> and <em>getQuantile(0.51)</em>.
This same 1% error applied at a rank of 0.95 means that the true quantile should be between <em>getQuantile(0.94)</em> and <em>getQuantile(0.96)</em>. In other words, the error is a fixed +/- epsilon for the entire range of ranks.</p>
<p>The approximate rank error values listed in the second row of the header in the table below can be computed using the function <i>KLLSketch.getNormalizedRankError(int k, false)</i>. The third row shows the double-sided error that applies to a portion of the distribution such as an element of PMF (bar in a histogram) that is a subject to rank error on both sides. It can be computed using the function <i>KLLSketch.getNormalizedRankError(int k, true)</i>.</p>
<h2 id="kllfloatssketch-java-or-kll_sketchfloat-c-serialized-size-in-bytes-from-k-or-rank-error--vs-n">KllFloatsSketch (Java) or kll_sketch&lt;float&gt; (C++) serialized size in bytes from <em>K</em> or rank error % vs. <em>N</em>.</h2>
<table>
<thead>
<tr>
<th>N</th>
<th>K=25</th>
<th>K=50</th>
<th>K=100</th>
<th>K=200</th>
<th>K=400</th>
<th>K=800</th>
<th>K=1600</th>
</tr>
</thead>
<tbody>
<tr>
<td>single-sided error</td>
<td>10.04%</td>
<td>5.12%</td>
<td>2.61%</td>
<td>1.33%</td>
<td>0.68%</td>
<td>0.35%</td>
<td>0.18%</td>
</tr>
<tr>
<td>double-sided error</td>
<td>11.74%</td>
<td>6.11%</td>
<td>3.18%</td>
<td>1.65%</td>
<td>0.86%</td>
<td>0.45%</td>
<td>0.23%</td>
</tr>
<tr>
<td>0</td>
<td>8</td>
<td>8</td>
<td>8</td>
<td>8</td>
<td>8</td>
<td>8</td>
<td>8</td>
</tr>
<tr>
<td>1</td>
<td>40</td>
<td>40</td>
<td>40</td>
<td>40</td>
<td>40</td>
<td>40</td>
<td>40</td>
</tr>
<tr>
<td>2</td>
<td>44</td>
<td>44</td>
<td>44</td>
<td>44</td>
<td>44</td>
<td>44</td>
<td>44</td>
</tr>
<tr>
<td>4</td>
<td>52</td>
<td>52</td>
<td>52</td>
<td>52</td>
<td>52</td>
<td>52</td>
<td>52</td>
</tr>
<tr>
<td>8</td>
<td>68</td>
<td>68</td>
<td>68</td>
<td>68</td>
<td>68</td>
<td>68</td>
<td>68</td>
</tr>
<tr>
<td>16</td>
<td>100</td>
<td>100</td>
<td>100</td>
<td>100</td>
<td>100</td>
<td>100</td>
<td>100</td>
</tr>
<tr>
<td>32</td>
<td>120</td>
<td>164</td>
<td>164</td>
<td>164</td>
<td>164</td>
<td>164</td>
<td>164</td>
</tr>
<tr>
<td>64</td>
<td>188</td>
<td>196</td>
<td>292</td>
<td>292</td>
<td>292</td>
<td>292</td>
<td>292</td>
</tr>
<tr>
<td>128</td>
<td>220</td>
<td>336</td>
<td>352</td>
<td>548</td>
<td>548</td>
<td>548</td>
<td>548</td>
</tr>
<tr>
<td>256</td>
<td>268</td>
<td>396</td>
<td>632</td>
<td>664</td>
<td>1,060</td>
<td>1,060</td>
<td>1,060</td>
</tr>
<tr>
<td>512</td>
<td>288</td>
<td>524</td>
<td>744</td>
<td>1,224</td>
<td>1,288</td>
<td>2,084</td>
<td>2,084</td>
</tr>
<tr>
<td>1,024</td>
<td>356</td>
<td>568</td>
<td>988</td>
<td>1,436</td>
<td>2,404</td>
<td>2,536</td>
<td>4,132</td>
</tr>
<tr>
<td>2,048</td>
<td>392</td>
<td>556</td>
<td>1,036</td>
<td>1,912</td>
<td>2,812</td>
<td>4,768</td>
<td>5,032</td>
</tr>
<tr>
<td>4,096</td>
<td>428</td>
<td>628</td>
<td>1,012</td>
<td>1,996</td>
<td>3,740</td>
<td>5,580</td>
<td>9,492</td>
</tr>
<tr>
<td>8,192</td>
<td>448</td>
<td>656</td>
<td>1,004</td>
<td>2,156</td>
<td>3,844</td>
<td>7,440</td>
<td>11,116</td>
</tr>
<tr>
<td>16,384</td>
<td>496</td>
<td>708</td>
<td>1,224</td>
<td>2,148</td>
<td>4,104</td>
<td>7,648</td>
<td>14,820</td>
</tr>
<tr>
<td>32,768</td>
<td>528</td>
<td>740</td>
<td>1,260</td>
<td>2,344</td>
<td>4,384</td>
<td>8,236</td>
<td>15,228</td>
</tr>
<tr>
<td>65,536</td>
<td>556</td>
<td>764</td>
<td>1,292</td>
<td>2,120</td>
<td>4,664</td>
<td>8,772</td>
<td>16,236</td>
</tr>
<tr>
<td>131,072</td>
<td>612</td>
<td>800</td>
<td>1,304</td>
<td>2,436</td>
<td>4,740</td>
<td>9,280</td>
<td>17,592</td>
</tr>
<tr>
<td>262,144</td>
<td>632</td>
<td>844</td>
<td>1,352</td>
<td>2,464</td>
<td>4,744</td>
<td>8,644</td>
<td>18,268</td>
</tr>
<tr>
<td>524,288</td>
<td>680</td>
<td>880</td>
<td>1,392</td>
<td>2,512</td>
<td>4,780</td>
<td>9,344</td>
<td>18,724</td>
</tr>
<tr>
<td>1,048,576</td>
<td>720</td>
<td>916</td>
<td>1,436</td>
<td>2,548</td>
<td>4,772</td>
<td>9,560</td>
<td>18,932</td>
</tr>
<tr>
<td>2,097,152</td>
<td>744</td>
<td>948</td>
<td>1,460</td>
<td>2,584</td>
<td>4,860</td>
<td>9,584</td>
<td>19,008</td>
</tr>
<tr>
<td>4,194,304</td>
<td>780</td>
<td>1,000</td>
<td>1,500</td>
<td>2,616</td>
<td>4,928</td>
<td>9,572</td>
<td>18,892</td>
</tr>
<tr>
<td>8,388,608</td>
<td>812</td>
<td>1,032</td>
<td>1,540</td>
<td>2,640</td>
<td>4,960</td>
<td>9,656</td>
<td>19,036</td>
</tr>
<tr>
<td>16,777,216</td>
<td>852</td>
<td>1,052</td>
<td>1,584</td>
<td>2,680</td>
<td>5,000</td>
<td>9,708</td>
<td>19,204</td>
</tr>
<tr>
<td>33,554,432</td>
<td>892</td>
<td>1,108</td>
<td>1,620</td>
<td>2,724</td>
<td>5,032</td>
<td>9,728</td>
<td>18,620</td>
</tr>
<tr>
<td>67,108,864</td>
<td>928</td>
<td>1,124</td>
<td>1,648</td>
<td>2,760</td>
<td>5,040</td>
<td>9,764</td>
<td>19,276</td>
</tr>
<tr>
<td>134,217,728</td>
<td>936</td>
<td>1,168</td>
<td>1,688</td>
<td>2,780</td>
<td>5,100</td>
<td>9,808</td>
<td>19,304</td>
</tr>
<tr>
<td>268,435,456</td>
<td>964</td>
<td>1,200</td>
<td>1,696</td>
<td>2,832</td>
<td>5,136</td>
<td>9,848</td>
<td>19,336</td>
</tr>
<tr>
<td>536,870,912</td>
<td>992</td>
<td>1,232</td>
<td>1,752</td>
<td>2,868</td>
<td>5,176</td>
<td>9,876</td>
<td>19,396</td>
</tr>
<tr>
<td>1,073,741,824</td>
<td>1,020</td>
<td>1,284</td>
<td>1,784</td>
<td>2,888</td>
<td>5,212</td>
<td>9,924</td>
<td>19,404</td>
</tr>
<tr>
<td>2,147,483,648</td>
<td>1,080</td>
<td>1,308</td>
<td>1,824</td>
<td>2,924</td>
<td>5,244</td>
<td>9,956</td>
<td>19,448</td>
</tr>
<tr>
<td>4,294,967,296</td>
<td>1,108</td>
<td>1,356</td>
<td>1,864</td>
<td>2,976</td>
<td>5,264</td>
<td>9,980</td>
<td>19,488</td>
</tr>
<tr>
<td>8,589,934,592</td>
<td>1,148</td>
<td>1,384</td>
<td>1,888</td>
<td>2,992</td>
<td>5,312</td>
<td>10,032</td>
<td>19,540</td>
</tr>
<tr>
<td>17,179,869,184</td>
<td>1,188</td>
<td>1,432</td>
<td>1,936</td>
<td>3,040</td>
<td>5,344</td>
<td>10,052</td>
<td>19,576</td>
</tr>
</tbody>
</table>
<h2 id="klldoublessketch-java-or-kll_sketchdouble-c-serialized-size-in-bytes-from-k-or-rank-error--vs-n">KllDoublesSketch (Java) or kll_sketch&lt;double&gt; (C++) serialized size in bytes from <em>K</em> or rank error % vs. <em>N</em>.</h2>
<table>
<thead>
<tr>
<th>N</th>
<th>K=25</th>
<th>K=50</th>
<th>K=100</th>
<th>K=200</th>
<th>K=400</th>
<th>K=800</th>
<th>k=1600</th>
</tr>
</thead>
<tbody>
<tr>
<td>single-sided error</td>
<td>10.04%</td>
<td>5.12%</td>
<td>2.61%</td>
<td>1.33%</td>
<td>0.68%</td>
<td>0.35%</td>
<td>0.18%</td>
</tr>
<tr>
<td>double-sided error</td>
<td>11.74%</td>
<td>6.11%</td>
<td>3.18%</td>
<td>1.65%</td>
<td>0.86%</td>
<td>0.45%</td>
<td>0.23%</td>
</tr>
<tr>
<td>0</td>
<td>8</td>
<td>8</td>
<td>8</td>
<td>8</td>
<td>8</td>
<td>8</td>
<td>8</td>
</tr>
<tr>
<td>1</td>
<td>56</td>
<td>56</td>
<td>56</td>
<td>56</td>
<td>56</td>
<td>56</td>
<td>56</td>
</tr>
<tr>
<td>2</td>
<td>64</td>
<td>64</td>
<td>64</td>
<td>64</td>
<td>64</td>
<td>64</td>
<td>64</td>
</tr>
<tr>
<td>4</td>
<td>80</td>
<td>80</td>
<td>80</td>
<td>80</td>
<td>80</td>
<td>80</td>
<td>80</td>
</tr>
<tr>
<td>8</td>
<td>112</td>
<td>112</td>
<td>112</td>
<td>112</td>
<td>112</td>
<td>112</td>
<td>112</td>
</tr>
<tr>
<td>16</td>
<td>176</td>
<td>176</td>
<td>176</td>
<td>176</td>
<td>176</td>
<td>176</td>
<td>176</td>
</tr>
<tr>
<td>32</td>
<td>212</td>
<td>304</td>
<td>304</td>
<td>304</td>
<td>304</td>
<td>304</td>
<td>304</td>
</tr>
<tr>
<td>64</td>
<td>348</td>
<td>364</td>
<td>560</td>
<td>560</td>
<td>560</td>
<td>560</td>
<td>560</td>
</tr>
<tr>
<td>128</td>
<td>408</td>
<td>644</td>
<td>676</td>
<td>1,072</td>
<td>1,072</td>
<td>1,072</td>
<td>1,072</td>
</tr>
<tr>
<td>256</td>
<td>500</td>
<td>760</td>
<td>1,236</td>
<td>1,300</td>
<td>2,096</td>
<td>2,096</td>
<td>2,096</td>
</tr>
<tr>
<td>512</td>
<td>536</td>
<td>1,012</td>
<td>1,456</td>
<td>2,420</td>
<td>2,548</td>
<td>4,144</td>
<td>4,144</td>
</tr>
<tr>
<td>1,024</td>
<td>668</td>
<td>1,096</td>
<td>1,940</td>
<td>2,840</td>
<td>4,780</td>
<td>5,044</td>
<td>8,240</td>
</tr>
<tr>
<td>2,048</td>
<td>736</td>
<td>1,068</td>
<td>2,032</td>
<td>3,788</td>
<td>5,592</td>
<td>9,508</td>
<td>10,036</td>
</tr>
<tr>
<td>4,096</td>
<td>804</td>
<td>1,208</td>
<td>1,980</td>
<td>3,952</td>
<td>7,444</td>
<td>11,128</td>
<td>18,956</td>
</tr>
<tr>
<td>8,192</td>
<td>840</td>
<td>1,260</td>
<td>1,960</td>
<td>4,268</td>
<td>7,648</td>
<td>14,844</td>
<td>22,200</td>
</tr>
<tr>
<td>16,384</td>
<td>932</td>
<td>1,360</td>
<td>2,396</td>
<td>4,248</td>
<td>8,164</td>
<td>15,256</td>
<td>29,604</td>
</tr>
<tr>
<td>32,768</td>
<td>992</td>
<td>1,420</td>
<td>2,464</td>
<td>4,636</td>
<td>8,720</td>
<td>16,428</td>
<td>30,416</td>
</tr>
<tr>
<td>65,536</td>
<td>1,044</td>
<td>1,464</td>
<td>2,524</td>
<td>4,184</td>
<td>9,276</td>
<td>17,496</td>
<td>32,428</td>
</tr>
<tr>
<td>131,072</td>
<td>1,152</td>
<td>1,532</td>
<td>2,544</td>
<td>4,812</td>
<td>9,424</td>
<td>18,508</td>
<td>35,136</td>
</tr>
<tr>
<td>262,144</td>
<td>1,188</td>
<td>1,616</td>
<td>2,636</td>
<td>4,864</td>
<td>9,428</td>
<td>17,232</td>
<td>36,484</td>
</tr>
<tr>
<td>524,288</td>
<td>1,280</td>
<td>1,684</td>
<td>2,712</td>
<td>4,956</td>
<td>9,496</td>
<td>18,628</td>
<td>37,392</td>
</tr>
<tr>
<td>1,048,576</td>
<td>1,356</td>
<td>1,752</td>
<td>2,796</td>
<td>5,024</td>
<td>9,476</td>
<td>19,056</td>
<td>37,804</td>
</tr>
<tr>
<td>2,097,152</td>
<td>1,400</td>
<td>1,812</td>
<td>2,840</td>
<td>5,092</td>
<td>9,648</td>
<td>19,100</td>
<td>37,952</td>
</tr>
<tr>
<td>4,194,304</td>
<td>1,468</td>
<td>1,912</td>
<td>2,916</td>
<td>5,152</td>
<td>9,780</td>
<td>19,072</td>
<td>37,716</td>
</tr>
<tr>
<td>8,388,608</td>
<td>1,528</td>
<td>1,972</td>
<td>2,992</td>
<td>5,196</td>
<td>9,840</td>
<td>19,236</td>
<td>38,000</td>
</tr>
<tr>
<td>16,777,216</td>
<td>1,604</td>
<td>2,008</td>
<td>3,076</td>
<td>5,272</td>
<td>9,916</td>
<td>19,336</td>
<td>38,332</td>
</tr>
<tr>
<td>33,554,432</td>
<td>1,680</td>
<td>2,116</td>
<td>3,144</td>
<td>5,356</td>
<td>9,976</td>
<td>19,372</td>
<td>37,160</td>
</tr>
<tr>
<td>67,108,864</td>
<td>1,748</td>
<td>2,144</td>
<td>3,196</td>
<td>5,424</td>
<td>9,988</td>
<td>19,440</td>
<td>38,468</td>
</tr>
<tr>
<td>134,217,728</td>
<td>1,764</td>
<td>2,228</td>
<td>3,272</td>
<td>5,460</td>
<td>10,104</td>
<td>19,524</td>
<td>38,520</td>
</tr>
<tr>
<td>268,435,456</td>
<td>1,816</td>
<td>2,288</td>
<td>3,284</td>
<td>5,560</td>
<td>10,172</td>
<td>19,600</td>
<td>38,580</td>
</tr>
<tr>
<td>536,870,912</td>
<td>1,868</td>
<td>2,348</td>
<td>3,392</td>
<td>5,628</td>
<td>10,248</td>
<td>19,652</td>
<td>38,696</td>
</tr>
<tr>
<td>1,073,741,824</td>
<td>1,920</td>
<td>2,448</td>
<td>3,452</td>
<td>5,664</td>
<td>10,316</td>
<td>19,744</td>
<td>38,708</td>
</tr>
<tr>
<td>2,147,483,648</td>
<td>2,036</td>
<td>2,492</td>
<td>3,528</td>
<td>5,732</td>
<td>10,376</td>
<td>19,804</td>
<td>38,792</td>
</tr>
<tr>
<td>4,294,967,296</td>
<td>2,088</td>
<td>2,584</td>
<td>3,604</td>
<td>5,832</td>
<td>10,412</td>
<td>19,848</td>
<td>38,868</td>
</tr>
<tr>
<td>8,589,934,592</td>
<td>2,164</td>
<td>2,636</td>
<td>3,648</td>
<td>5,860</td>
<td>10,504</td>
<td>19,948</td>
<td>38,968</td>
</tr>
<tr>
<td>17,179,869,184</td>
<td>2,240</td>
<td>2,728</td>
<td>3,740</td>
<td>5,952</td>
<td>10,564</td>
<td>19,984</td>
<td>39,036</td>
</tr>
</tbody>
</table>
</div> <!-- End content -->
</div> <!-- End row -->
</div> <!-- End Container -->
<!-- Start _include/page_footer.html -->
<footer class="ds-footer">
<div class="container">
<div class="text-center">
<p>
<div>Copyright © 2020 <a href="https://www.apache.org">Apache Software Foundation</a>,
Licensed under the Apache License, Version 2.0. All Rights Reserved.<br/>
Apache DataSketches, Apache, the Apache feather logo, and the Apache DataSketches project logos are trademarks of The Apache Software Foundation.<br/>
All other marks mentioned may be trademarks or registered trademarks of their respective owners.
</div>
</p>
</div>
</div>
</footer>
<!-- End _include/page_footer.html -->
</body>
</html>
<!-- End _layouts/doc_page.html-->