blob: fc8752d957c6a0d84f58dc622e1e2d0ca3c79491 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_181-google-v7) on Mon Jan 27 16:42:30 PST 2020 -->
<title>Top (Apache Beam 2.20.0-SNAPSHOT)</title>
<meta name="date" content="2020-01-27">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Top (Apache Beam 2.20.0-SNAPSHOT)";
}
}
catch(err) {
}
//-->
var methods = {"i0":9,"i1":9,"i2":9,"i3":9,"i4":9,"i5":9,"i6":9,"i7":9,"i8":9,"i9":9,"i10":9,"i11":9,"i12":9,"i13":9};
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</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">
<li><a href="../../../../../org/apache/beam/sdk/transforms/ToJson.html" title="class in org.apache.beam.sdk.transforms"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../../org/apache/beam/sdk/transforms/Top.Largest.html" title="class in org.apache.beam.sdk.transforms"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/beam/sdk/transforms/Top.html" target="_top">Frames</a></li>
<li><a href="Top.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></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>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.beam.sdk.transforms</div>
<h2 title="Class Top" class="title">Class Top</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>org.apache.beam.sdk.transforms.Top</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="typeNameLabel">Top</span>
extends java.lang.Object</pre>
<div class="block"><code>PTransform</code>s for finding the largest (or smallest) set of elements in a <code>PCollection</code>, or the largest (or smallest) set of values associated with each key in a <code>PCollection</code> of <code>KV</code>s.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="nested.class.summary">
<!-- -->
</a>
<h3>Nested Class Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Nested Class Summary table, listing nested classes, and an explanation">
<caption><span>Nested Classes</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Class and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/transforms/Top.Largest.html" title="class in org.apache.beam.sdk.transforms">Top.Largest</a>&lt;<a href="../../../../../org/apache/beam/sdk/transforms/Top.Largest.html" title="type parameter in Top.Largest">T</a> extends java.lang.Comparable&lt;? super <a href="../../../../../org/apache/beam/sdk/transforms/Top.Largest.html" title="type parameter in Top.Largest">T</a>&gt;&gt;</span></code>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;
<div class="block"><span class="deprecationComment">use <a href="../../../../../org/apache/beam/sdk/transforms/Top.Natural.html" title="class in org.apache.beam.sdk.transforms"><code>Top.Natural</code></a> instead</span></div>
</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/transforms/Top.Natural.html" title="class in org.apache.beam.sdk.transforms">Top.Natural</a>&lt;<a href="../../../../../org/apache/beam/sdk/transforms/Top.Natural.html" title="type parameter in Top.Natural">T</a> extends java.lang.Comparable&lt;? super <a href="../../../../../org/apache/beam/sdk/transforms/Top.Natural.html" title="type parameter in Top.Natural">T</a>&gt;&gt;</span></code>
<div class="block">A <code>Serializable</code> <code>Comparator</code> that that uses the compared elements' natural
ordering.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/transforms/Top.Reversed.html" title="class in org.apache.beam.sdk.transforms">Top.Reversed</a>&lt;<a href="../../../../../org/apache/beam/sdk/transforms/Top.Reversed.html" title="type parameter in Top.Reversed">T</a> extends java.lang.Comparable&lt;? super <a href="../../../../../org/apache/beam/sdk/transforms/Top.Reversed.html" title="type parameter in Top.Reversed">T</a>&gt;&gt;</span></code>
<div class="block"><code>Serializable</code> <code>Comparator</code> that that uses the reverse of the compared elements'
natural ordering.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/transforms/Top.Smallest.html" title="class in org.apache.beam.sdk.transforms">Top.Smallest</a>&lt;<a href="../../../../../org/apache/beam/sdk/transforms/Top.Smallest.html" title="type parameter in Top.Smallest">T</a> extends java.lang.Comparable&lt;? super <a href="../../../../../org/apache/beam/sdk/transforms/Top.Smallest.html" title="type parameter in Top.Smallest">T</a>&gt;&gt;</span></code>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;
<div class="block"><span class="deprecationComment">use <a href="../../../../../org/apache/beam/sdk/transforms/Top.Reversed.html" title="class in org.apache.beam.sdk.transforms"><code>Top.Reversed</code></a> instead</span></div>
</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms">Top.TopCombineFn</a>&lt;<a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="type parameter in Top.TopCombineFn">T</a>,<a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="type parameter in Top.TopCombineFn">ComparatorT</a> extends java.util.Comparator&lt;<a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="type parameter in Top.TopCombineFn">T</a>&gt; &amp; java.io.Serializable&gt;</span></code>
<div class="block"><code>CombineFn</code> for <code>Top</code> transforms that combines a bunch of <code>T</code>s into a single
<code>count</code>-long <code>List&lt;T&gt;</code>, using <code>compareFn</code> to choose the largest <code>T</code>s.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>static &lt;T extends java.lang.Comparable&lt;T&gt;&gt;<br><a href="../../../../../org/apache/beam/sdk/transforms/Combine.Globally.html" title="class in org.apache.beam.sdk.transforms">Combine.Globally</a>&lt;T,java.util.List&lt;T&gt;&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/transforms/Top.html#largest-int-">largest</a></span>(int&nbsp;count)</code>
<div class="block">Returns a <code>PTransform</code> that takes an input <code>PCollection&lt;T&gt;</code> and returns a <code>PCollection&lt;List&lt;T&gt;&gt;</code> with a single element containing the largest <code>count</code> elements of
the input <code>PCollection&lt;T&gt;</code>, in decreasing order, sorted according to their natural order.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms">Top.TopCombineFn</a>&lt;java.lang.Double,<a href="../../../../../org/apache/beam/sdk/transforms/Top.Natural.html" title="class in org.apache.beam.sdk.transforms">Top.Natural</a>&lt;java.lang.Double&gt;&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/transforms/Top.html#largestDoublesFn-int-">largestDoublesFn</a></span>(int&nbsp;count)</code>
<div class="block">Returns a <a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms"><code>Top.TopCombineFn</code></a> that aggregates the largest count double values.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>static &lt;T extends java.lang.Comparable&lt;T&gt;&gt;<br><a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms">Top.TopCombineFn</a>&lt;T,<a href="../../../../../org/apache/beam/sdk/transforms/Top.Natural.html" title="class in org.apache.beam.sdk.transforms">Top.Natural</a>&lt;T&gt;&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/transforms/Top.html#largestFn-int-">largestFn</a></span>(int&nbsp;count)</code>
<div class="block">Returns a <a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms"><code>Top.TopCombineFn</code></a> that aggregates the largest count values.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms">Top.TopCombineFn</a>&lt;java.lang.Integer,<a href="../../../../../org/apache/beam/sdk/transforms/Top.Natural.html" title="class in org.apache.beam.sdk.transforms">Top.Natural</a>&lt;java.lang.Integer&gt;&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/transforms/Top.html#largestIntsFn-int-">largestIntsFn</a></span>(int&nbsp;count)</code>
<div class="block">Returns a <a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms"><code>Top.TopCombineFn</code></a> that aggregates the largest count int values.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms">Top.TopCombineFn</a>&lt;java.lang.Long,<a href="../../../../../org/apache/beam/sdk/transforms/Top.Natural.html" title="class in org.apache.beam.sdk.transforms">Top.Natural</a>&lt;java.lang.Long&gt;&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/transforms/Top.html#largestLongsFn-int-">largestLongsFn</a></span>(int&nbsp;count)</code>
<div class="block">Returns a <a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms"><code>Top.TopCombineFn</code></a> that aggregates the largest count long values.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>static &lt;K,V extends java.lang.Comparable&lt;V&gt;&gt;<br><a href="../../../../../org/apache/beam/sdk/transforms/Combine.PerKey.html" title="class in org.apache.beam.sdk.transforms">Combine.PerKey</a>&lt;K,V,java.util.List&lt;V&gt;&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/transforms/Top.html#largestPerKey-int-">largestPerKey</a></span>(int&nbsp;count)</code>
<div class="block">Returns a <code>PTransform</code> that takes an input <code>PCollection&lt;KV&lt;K, V&gt;&gt;</code> and returns a
<code>PCollection&lt;KV&lt;K, List&lt;V&gt;&gt;&gt;</code> that contains an output element mapping each distinct key
in the input <code>PCollection</code> to the largest <code>count</code> values associated with that key
in the input <code>PCollection&lt;KV&lt;K, V&gt;&gt;</code>, in decreasing order, sorted according to their
natural order.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>static &lt;T,ComparatorT extends java.util.Comparator&lt;T&gt; &amp; java.io.Serializable&gt;<br><a href="../../../../../org/apache/beam/sdk/transforms/Combine.Globally.html" title="class in org.apache.beam.sdk.transforms">Combine.Globally</a>&lt;T,java.util.List&lt;T&gt;&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/transforms/Top.html#of-int-ComparatorT-">of</a></span>(int&nbsp;count,
ComparatorT&nbsp;compareFn)</code>
<div class="block">Returns a <code>PTransform</code> that takes an input <code>PCollection&lt;T&gt;</code> and returns a <code>PCollection&lt;List&lt;T&gt;&gt;</code> with a single element containing the largest <code>count</code> elements of
the input <code>PCollection&lt;T&gt;</code>, in decreasing order, sorted using the given <code>Comparator&lt;T&gt;</code>.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>static &lt;K,V,ComparatorT extends java.util.Comparator&lt;V&gt; &amp; java.io.Serializable&gt;<br><a href="../../../../../org/apache/beam/sdk/transforms/PTransform.html" title="class in org.apache.beam.sdk.transforms">PTransform</a>&lt;<a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values">PCollection</a>&lt;<a href="../../../../../org/apache/beam/sdk/values/KV.html" title="class in org.apache.beam.sdk.values">KV</a>&lt;K,V&gt;&gt;,<a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values">PCollection</a>&lt;<a href="../../../../../org/apache/beam/sdk/values/KV.html" title="class in org.apache.beam.sdk.values">KV</a>&lt;K,java.util.List&lt;V&gt;&gt;&gt;&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/transforms/Top.html#perKey-int-ComparatorT-">perKey</a></span>(int&nbsp;count,
ComparatorT&nbsp;compareFn)</code>
<div class="block">Returns a <code>PTransform</code> that takes an input <code>PCollection&lt;KV&lt;K, V&gt;&gt;</code> and returns a
<code>PCollection&lt;KV&lt;K, List&lt;V&gt;&gt;&gt;</code> that contains an output element mapping each distinct key
in the input <code>PCollection</code> to the largest <code>count</code> values associated with that key
in the input <code>PCollection&lt;KV&lt;K, V&gt;&gt;</code>, in decreasing order, sorted using the given <code>Comparator&lt;V&gt;</code>.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>static &lt;T extends java.lang.Comparable&lt;T&gt;&gt;<br><a href="../../../../../org/apache/beam/sdk/transforms/Combine.Globally.html" title="class in org.apache.beam.sdk.transforms">Combine.Globally</a>&lt;T,java.util.List&lt;T&gt;&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/transforms/Top.html#smallest-int-">smallest</a></span>(int&nbsp;count)</code>
<div class="block">Returns a <code>PTransform</code> that takes an input <code>PCollection&lt;T&gt;</code> and returns a <code>PCollection&lt;List&lt;T&gt;&gt;</code> with a single element containing the smallest <code>count</code> elements of
the input <code>PCollection&lt;T&gt;</code>, in increasing order, sorted according to their natural order.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms">Top.TopCombineFn</a>&lt;java.lang.Double,<a href="../../../../../org/apache/beam/sdk/transforms/Top.Reversed.html" title="class in org.apache.beam.sdk.transforms">Top.Reversed</a>&lt;java.lang.Double&gt;&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/transforms/Top.html#smallestDoublesFn-int-">smallestDoublesFn</a></span>(int&nbsp;count)</code>
<div class="block">Returns a <a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms"><code>Top.TopCombineFn</code></a> that aggregates the smallest count double values.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>static &lt;T extends java.lang.Comparable&lt;T&gt;&gt;<br><a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms">Top.TopCombineFn</a>&lt;T,<a href="../../../../../org/apache/beam/sdk/transforms/Top.Reversed.html" title="class in org.apache.beam.sdk.transforms">Top.Reversed</a>&lt;T&gt;&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/transforms/Top.html#smallestFn-int-">smallestFn</a></span>(int&nbsp;count)</code>
<div class="block">Returns a <a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms"><code>Top.TopCombineFn</code></a> that aggregates the smallest count values.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms">Top.TopCombineFn</a>&lt;java.lang.Integer,<a href="../../../../../org/apache/beam/sdk/transforms/Top.Reversed.html" title="class in org.apache.beam.sdk.transforms">Top.Reversed</a>&lt;java.lang.Integer&gt;&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/transforms/Top.html#smallestIntsFn-int-">smallestIntsFn</a></span>(int&nbsp;count)</code>
<div class="block">Returns a <a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms"><code>Top.TopCombineFn</code></a> that aggregates the smallest count int values.</div>
</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms">Top.TopCombineFn</a>&lt;java.lang.Long,<a href="../../../../../org/apache/beam/sdk/transforms/Top.Reversed.html" title="class in org.apache.beam.sdk.transforms">Top.Reversed</a>&lt;java.lang.Long&gt;&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/transforms/Top.html#smallestLongsFn-int-">smallestLongsFn</a></span>(int&nbsp;count)</code>
<div class="block">Returns a <a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms"><code>Top.TopCombineFn</code></a> that aggregates the smallest count long values.</div>
</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code>static &lt;K,V extends java.lang.Comparable&lt;V&gt;&gt;<br><a href="../../../../../org/apache/beam/sdk/transforms/PTransform.html" title="class in org.apache.beam.sdk.transforms">PTransform</a>&lt;<a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values">PCollection</a>&lt;<a href="../../../../../org/apache/beam/sdk/values/KV.html" title="class in org.apache.beam.sdk.values">KV</a>&lt;K,V&gt;&gt;,<a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values">PCollection</a>&lt;<a href="../../../../../org/apache/beam/sdk/values/KV.html" title="class in org.apache.beam.sdk.values">KV</a>&lt;K,java.util.List&lt;V&gt;&gt;&gt;&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/transforms/Top.html#smallestPerKey-int-">smallestPerKey</a></span>(int&nbsp;count)</code>
<div class="block">Returns a <code>PTransform</code> that takes an input <code>PCollection&lt;KV&lt;K, V&gt;&gt;</code> and returns a
<code>PCollection&lt;KV&lt;K, List&lt;V&gt;&gt;&gt;</code> that contains an output element mapping each distinct key
in the input <code>PCollection</code> to the smallest <code>count</code> values associated with that key
in the input <code>PCollection&lt;KV&lt;K, V&gt;&gt;</code>, in increasing order, sorted according to their
natural order.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="of-int-java.util.Comparator-">
<!-- -->
</a><a name="of-int-ComparatorT-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>of</h4>
<pre>public static&nbsp;&lt;T,ComparatorT extends java.util.Comparator&lt;T&gt; &amp; java.io.Serializable&gt;&nbsp;<a href="../../../../../org/apache/beam/sdk/transforms/Combine.Globally.html" title="class in org.apache.beam.sdk.transforms">Combine.Globally</a>&lt;T,java.util.List&lt;T&gt;&gt;&nbsp;of(int&nbsp;count,
ComparatorT&nbsp;compareFn)</pre>
<div class="block">Returns a <code>PTransform</code> that takes an input <code>PCollection&lt;T&gt;</code> and returns a <code>PCollection&lt;List&lt;T&gt;&gt;</code> with a single element containing the largest <code>count</code> elements of
the input <code>PCollection&lt;T&gt;</code>, in decreasing order, sorted using the given <code>Comparator&lt;T&gt;</code>. The <code>Comparator&lt;T&gt;</code> must also be <code>Serializable</code>.
<p>If <code>count</code> <code>&gt;</code> the number of elements in the input <code>PCollection</code>, then all
the elements of the input <code>PCollection</code> will be in the resulting <code>List</code>, albeit in
sorted order.
<p>All the elements of the result's <code>List</code> must fit into the memory of a single machine.
<p>Example of use:
<pre><code>
PCollection&lt;Student&gt; students = ...;
PCollection&lt;List&lt;Student&gt;&gt; top10Students =
students.apply(Top.of(10, new CompareStudentsByAvgGrade()));
</code></pre>
<p>By default, the <code>Coder</code> of the output <code>PCollection</code> is a <code>ListCoder</code> of
the <code>Coder</code> of the elements of the input <code>PCollection</code>.
<p>If the input <code>PCollection</code> is windowed into <a href="../../../../../org/apache/beam/sdk/transforms/windowing/GlobalWindows.html" title="class in org.apache.beam.sdk.transforms.windowing"><code>GlobalWindows</code></a>, an empty <code>List&lt;T&gt;</code> in the <a href="../../../../../org/apache/beam/sdk/transforms/windowing/GlobalWindow.html" title="class in org.apache.beam.sdk.transforms.windowing"><code>GlobalWindow</code></a> will be output if the input <code>PCollection</code> is empty.
To use this with inputs with other windowing, either <a href="../../../../../org/apache/beam/sdk/transforms/Combine.Globally.html#withoutDefaults--"><code>withoutDefaults</code></a> or <a href="../../../../../org/apache/beam/sdk/transforms/Combine.Globally.html#asSingletonView--"><code>asSingletonView</code></a> must be called.
<p>See also <a href="../../../../../org/apache/beam/sdk/transforms/Top.html#smallest-int-"><code>smallest(int)</code></a> and <a href="../../../../../org/apache/beam/sdk/transforms/Top.html#largest-int-"><code>largest(int)</code></a>, which sort <code>Comparable</code> elements
using their natural ordering.
<p>See also <a href="../../../../../org/apache/beam/sdk/transforms/Top.html#perKey-int-ComparatorT-"><code>perKey(int, ComparatorT)</code></a>, <a href="../../../../../org/apache/beam/sdk/transforms/Top.html#smallestPerKey-int-"><code>smallestPerKey(int)</code></a>, and <a href="../../../../../org/apache/beam/sdk/transforms/Top.html#largestPerKey-int-"><code>largestPerKey(int)</code></a>, which take a
<code>PCollection</code> of <code>KV</code>s and return the top values associated with each key.</div>
</li>
</ul>
<a name="smallest-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>smallest</h4>
<pre>public static&nbsp;&lt;T extends java.lang.Comparable&lt;T&gt;&gt;&nbsp;<a href="../../../../../org/apache/beam/sdk/transforms/Combine.Globally.html" title="class in org.apache.beam.sdk.transforms">Combine.Globally</a>&lt;T,java.util.List&lt;T&gt;&gt;&nbsp;smallest(int&nbsp;count)</pre>
<div class="block">Returns a <code>PTransform</code> that takes an input <code>PCollection&lt;T&gt;</code> and returns a <code>PCollection&lt;List&lt;T&gt;&gt;</code> with a single element containing the smallest <code>count</code> elements of
the input <code>PCollection&lt;T&gt;</code>, in increasing order, sorted according to their natural order.
<p>If <code>count</code> <code>&gt;</code> the number of elements in the input <code>PCollection</code>, then all
the elements of the input <code>PCollection</code> will be in the resulting <code>PCollection</code>'s
<code>List</code>, albeit in sorted order.
<p>All the elements of the result <code>List</code> must fit into the memory of a single machine.
<p>Example of use:
<pre><code>
PCollection&lt;Integer&gt; values = ...;
PCollection&lt;List&lt;Integer&gt;&gt; smallest10Values = values.apply(Top.smallest(10));
</code></pre>
<p>By default, the <code>Coder</code> of the output <code>PCollection</code> is a <code>ListCoder</code> of
the <code>Coder</code> of the elements of the input <code>PCollection</code>.
<p>If the input <code>PCollection</code> is windowed into <a href="../../../../../org/apache/beam/sdk/transforms/windowing/GlobalWindows.html" title="class in org.apache.beam.sdk.transforms.windowing"><code>GlobalWindows</code></a>, an empty <code>List&lt;T&gt;</code> in the <a href="../../../../../org/apache/beam/sdk/transforms/windowing/GlobalWindow.html" title="class in org.apache.beam.sdk.transforms.windowing"><code>GlobalWindow</code></a> will be output if the input <code>PCollection</code> is empty.
To use this with inputs with other windowing, either <a href="../../../../../org/apache/beam/sdk/transforms/Combine.Globally.html#withoutDefaults--"><code>withoutDefaults</code></a> or <a href="../../../../../org/apache/beam/sdk/transforms/Combine.Globally.html#asSingletonView--"><code>asSingletonView</code></a> must be called.
<p>See also <a href="../../../../../org/apache/beam/sdk/transforms/Top.html#largest-int-"><code>largest(int)</code></a>.
<p>See also <a href="../../../../../org/apache/beam/sdk/transforms/Top.html#of-int-ComparatorT-"><code>of(int, ComparatorT)</code></a>, which sorts using a user-specified <code>Comparator</code> function.
<p>See also <a href="../../../../../org/apache/beam/sdk/transforms/Top.html#perKey-int-ComparatorT-"><code>perKey(int, ComparatorT)</code></a>, <a href="../../../../../org/apache/beam/sdk/transforms/Top.html#smallestPerKey-int-"><code>smallestPerKey(int)</code></a>, and <a href="../../../../../org/apache/beam/sdk/transforms/Top.html#largestPerKey-int-"><code>largestPerKey(int)</code></a>, which take a
<code>PCollection</code> of <code>KV</code>s and return the top values associated with each key.</div>
</li>
</ul>
<a name="largest-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>largest</h4>
<pre>public static&nbsp;&lt;T extends java.lang.Comparable&lt;T&gt;&gt;&nbsp;<a href="../../../../../org/apache/beam/sdk/transforms/Combine.Globally.html" title="class in org.apache.beam.sdk.transforms">Combine.Globally</a>&lt;T,java.util.List&lt;T&gt;&gt;&nbsp;largest(int&nbsp;count)</pre>
<div class="block">Returns a <code>PTransform</code> that takes an input <code>PCollection&lt;T&gt;</code> and returns a <code>PCollection&lt;List&lt;T&gt;&gt;</code> with a single element containing the largest <code>count</code> elements of
the input <code>PCollection&lt;T&gt;</code>, in decreasing order, sorted according to their natural order.
<p>If <code>count</code> <code>&gt;</code> the number of elements in the input <code>PCollection</code>, then all
the elements of the input <code>PCollection</code> will be in the resulting <code>PCollection</code>'s
<code>List</code>, albeit in sorted order.
<p>All the elements of the result's <code>List</code> must fit into the memory of a single machine.
<p>Example of use:
<pre><code>
PCollection&lt;Integer&gt; values = ...;
PCollection&lt;List&lt;Integer&gt;&gt; largest10Values = values.apply(Top.largest(10));
</code></pre>
<p>By default, the <code>Coder</code> of the output <code>PCollection</code> is a <code>ListCoder</code> of
the <code>Coder</code> of the elements of the input <code>PCollection</code>.
<p>If the input <code>PCollection</code> is windowed into <a href="../../../../../org/apache/beam/sdk/transforms/windowing/GlobalWindows.html" title="class in org.apache.beam.sdk.transforms.windowing"><code>GlobalWindows</code></a>, an empty <code>List&lt;T&gt;</code> in the <a href="../../../../../org/apache/beam/sdk/transforms/windowing/GlobalWindow.html" title="class in org.apache.beam.sdk.transforms.windowing"><code>GlobalWindow</code></a> will be output if the input <code>PCollection</code> is empty.
To use this with inputs with other windowing, either <a href="../../../../../org/apache/beam/sdk/transforms/Combine.Globally.html#withoutDefaults--"><code>withoutDefaults</code></a> or <a href="../../../../../org/apache/beam/sdk/transforms/Combine.Globally.html#asSingletonView--"><code>asSingletonView</code></a> must be called.
<p>See also <a href="../../../../../org/apache/beam/sdk/transforms/Top.html#smallest-int-"><code>smallest(int)</code></a>.
<p>See also <a href="../../../../../org/apache/beam/sdk/transforms/Top.html#of-int-ComparatorT-"><code>of(int, ComparatorT)</code></a>, which sorts using a user-specified <code>Comparator</code> function.
<p>See also <a href="../../../../../org/apache/beam/sdk/transforms/Top.html#perKey-int-ComparatorT-"><code>perKey(int, ComparatorT)</code></a>, <a href="../../../../../org/apache/beam/sdk/transforms/Top.html#smallestPerKey-int-"><code>smallestPerKey(int)</code></a>, and <a href="../../../../../org/apache/beam/sdk/transforms/Top.html#largestPerKey-int-"><code>largestPerKey(int)</code></a>, which take a
<code>PCollection</code> of <code>KV</code>s and return the top values associated with each key.</div>
</li>
</ul>
<a name="largestFn-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>largestFn</h4>
<pre>public static&nbsp;&lt;T extends java.lang.Comparable&lt;T&gt;&gt;&nbsp;<a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms">Top.TopCombineFn</a>&lt;T,<a href="../../../../../org/apache/beam/sdk/transforms/Top.Natural.html" title="class in org.apache.beam.sdk.transforms">Top.Natural</a>&lt;T&gt;&gt;&nbsp;largestFn(int&nbsp;count)</pre>
<div class="block">Returns a <a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms"><code>Top.TopCombineFn</code></a> that aggregates the largest count values.</div>
</li>
</ul>
<a name="largestLongsFn-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>largestLongsFn</h4>
<pre>public static&nbsp;<a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms">Top.TopCombineFn</a>&lt;java.lang.Long,<a href="../../../../../org/apache/beam/sdk/transforms/Top.Natural.html" title="class in org.apache.beam.sdk.transforms">Top.Natural</a>&lt;java.lang.Long&gt;&gt;&nbsp;largestLongsFn(int&nbsp;count)</pre>
<div class="block">Returns a <a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms"><code>Top.TopCombineFn</code></a> that aggregates the largest count long values.</div>
</li>
</ul>
<a name="largestIntsFn-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>largestIntsFn</h4>
<pre>public static&nbsp;<a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms">Top.TopCombineFn</a>&lt;java.lang.Integer,<a href="../../../../../org/apache/beam/sdk/transforms/Top.Natural.html" title="class in org.apache.beam.sdk.transforms">Top.Natural</a>&lt;java.lang.Integer&gt;&gt;&nbsp;largestIntsFn(int&nbsp;count)</pre>
<div class="block">Returns a <a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms"><code>Top.TopCombineFn</code></a> that aggregates the largest count int values.</div>
</li>
</ul>
<a name="largestDoublesFn-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>largestDoublesFn</h4>
<pre>public static&nbsp;<a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms">Top.TopCombineFn</a>&lt;java.lang.Double,<a href="../../../../../org/apache/beam/sdk/transforms/Top.Natural.html" title="class in org.apache.beam.sdk.transforms">Top.Natural</a>&lt;java.lang.Double&gt;&gt;&nbsp;largestDoublesFn(int&nbsp;count)</pre>
<div class="block">Returns a <a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms"><code>Top.TopCombineFn</code></a> that aggregates the largest count double values.</div>
</li>
</ul>
<a name="smallestFn-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>smallestFn</h4>
<pre>public static&nbsp;&lt;T extends java.lang.Comparable&lt;T&gt;&gt;&nbsp;<a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms">Top.TopCombineFn</a>&lt;T,<a href="../../../../../org/apache/beam/sdk/transforms/Top.Reversed.html" title="class in org.apache.beam.sdk.transforms">Top.Reversed</a>&lt;T&gt;&gt;&nbsp;smallestFn(int&nbsp;count)</pre>
<div class="block">Returns a <a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms"><code>Top.TopCombineFn</code></a> that aggregates the smallest count values.</div>
</li>
</ul>
<a name="smallestLongsFn-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>smallestLongsFn</h4>
<pre>public static&nbsp;<a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms">Top.TopCombineFn</a>&lt;java.lang.Long,<a href="../../../../../org/apache/beam/sdk/transforms/Top.Reversed.html" title="class in org.apache.beam.sdk.transforms">Top.Reversed</a>&lt;java.lang.Long&gt;&gt;&nbsp;smallestLongsFn(int&nbsp;count)</pre>
<div class="block">Returns a <a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms"><code>Top.TopCombineFn</code></a> that aggregates the smallest count long values.</div>
</li>
</ul>
<a name="smallestIntsFn-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>smallestIntsFn</h4>
<pre>public static&nbsp;<a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms">Top.TopCombineFn</a>&lt;java.lang.Integer,<a href="../../../../../org/apache/beam/sdk/transforms/Top.Reversed.html" title="class in org.apache.beam.sdk.transforms">Top.Reversed</a>&lt;java.lang.Integer&gt;&gt;&nbsp;smallestIntsFn(int&nbsp;count)</pre>
<div class="block">Returns a <a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms"><code>Top.TopCombineFn</code></a> that aggregates the smallest count int values.</div>
</li>
</ul>
<a name="smallestDoublesFn-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>smallestDoublesFn</h4>
<pre>public static&nbsp;<a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms">Top.TopCombineFn</a>&lt;java.lang.Double,<a href="../../../../../org/apache/beam/sdk/transforms/Top.Reversed.html" title="class in org.apache.beam.sdk.transforms">Top.Reversed</a>&lt;java.lang.Double&gt;&gt;&nbsp;smallestDoublesFn(int&nbsp;count)</pre>
<div class="block">Returns a <a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms"><code>Top.TopCombineFn</code></a> that aggregates the smallest count double values.</div>
</li>
</ul>
<a name="perKey-int-java.util.Comparator-">
<!-- -->
</a><a name="perKey-int-ComparatorT-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>perKey</h4>
<pre>public static&nbsp;&lt;K,V,ComparatorT extends java.util.Comparator&lt;V&gt; &amp; java.io.Serializable&gt;&nbsp;<a href="../../../../../org/apache/beam/sdk/transforms/PTransform.html" title="class in org.apache.beam.sdk.transforms">PTransform</a>&lt;<a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values">PCollection</a>&lt;<a href="../../../../../org/apache/beam/sdk/values/KV.html" title="class in org.apache.beam.sdk.values">KV</a>&lt;K,V&gt;&gt;,<a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values">PCollection</a>&lt;<a href="../../../../../org/apache/beam/sdk/values/KV.html" title="class in org.apache.beam.sdk.values">KV</a>&lt;K,java.util.List&lt;V&gt;&gt;&gt;&gt;&nbsp;perKey(int&nbsp;count,
ComparatorT&nbsp;compareFn)</pre>
<div class="block">Returns a <code>PTransform</code> that takes an input <code>PCollection&lt;KV&lt;K, V&gt;&gt;</code> and returns a
<code>PCollection&lt;KV&lt;K, List&lt;V&gt;&gt;&gt;</code> that contains an output element mapping each distinct key
in the input <code>PCollection</code> to the largest <code>count</code> values associated with that key
in the input <code>PCollection&lt;KV&lt;K, V&gt;&gt;</code>, in decreasing order, sorted using the given <code>Comparator&lt;V&gt;</code>. The <code>Comparator&lt;V&gt;</code> must also be <code>Serializable</code>.
<p>If there are fewer than <code>count</code> values associated with a particular key, then all
those values will be in the result mapping for that key, albeit in sorted order.
<p>All the values associated with a single key must fit into the memory of a single machine,
but there can be many more <code>KV</code>s in the resulting <code>PCollection</code> than can fit into
the memory of a single machine.
<p>Example of use:
<pre><code>
PCollection&lt;KV&lt;School, Student&gt;&gt; studentsBySchool = ...;
PCollection&lt;KV&lt;School, List&lt;Student&gt;&gt;&gt; top10StudentsBySchool =
studentsBySchool.apply(
Top.perKey(10, new CompareStudentsByAvgGrade()));
</code></pre>
<p>By default, the <code>Coder</code> of the keys of the output <code>PCollection</code> is the same as
that of the keys of the input <code>PCollection</code>, and the <code>Coder</code> of the values of the
output <code>PCollection</code> is a <code>ListCoder</code> of the <code>Coder</code> of the values of the
input <code>PCollection</code>.
<p>See also <a href="../../../../../org/apache/beam/sdk/transforms/Top.html#smallestPerKey-int-"><code>smallestPerKey(int)</code></a> and <a href="../../../../../org/apache/beam/sdk/transforms/Top.html#largestPerKey-int-"><code>largestPerKey(int)</code></a>, which sort <code>Comparable&lt;V&gt;</code> values using their natural ordering.
<p>See also <a href="../../../../../org/apache/beam/sdk/transforms/Top.html#of-int-ComparatorT-"><code>of(int, ComparatorT)</code></a>, <a href="../../../../../org/apache/beam/sdk/transforms/Top.html#smallest-int-"><code>smallest(int)</code></a>, and <a href="../../../../../org/apache/beam/sdk/transforms/Top.html#largest-int-"><code>largest(int)</code></a>, which take a <code>PCollection</code> and return the top elements.</div>
</li>
</ul>
<a name="smallestPerKey-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>smallestPerKey</h4>
<pre>public static&nbsp;&lt;K,V extends java.lang.Comparable&lt;V&gt;&gt;&nbsp;<a href="../../../../../org/apache/beam/sdk/transforms/PTransform.html" title="class in org.apache.beam.sdk.transforms">PTransform</a>&lt;<a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values">PCollection</a>&lt;<a href="../../../../../org/apache/beam/sdk/values/KV.html" title="class in org.apache.beam.sdk.values">KV</a>&lt;K,V&gt;&gt;,<a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values">PCollection</a>&lt;<a href="../../../../../org/apache/beam/sdk/values/KV.html" title="class in org.apache.beam.sdk.values">KV</a>&lt;K,java.util.List&lt;V&gt;&gt;&gt;&gt;&nbsp;smallestPerKey(int&nbsp;count)</pre>
<div class="block">Returns a <code>PTransform</code> that takes an input <code>PCollection&lt;KV&lt;K, V&gt;&gt;</code> and returns a
<code>PCollection&lt;KV&lt;K, List&lt;V&gt;&gt;&gt;</code> that contains an output element mapping each distinct key
in the input <code>PCollection</code> to the smallest <code>count</code> values associated with that key
in the input <code>PCollection&lt;KV&lt;K, V&gt;&gt;</code>, in increasing order, sorted according to their
natural order.
<p>If there are fewer than <code>count</code> values associated with a particular key, then all
those values will be in the result mapping for that key, albeit in sorted order.
<p>All the values associated with a single key must fit into the memory of a single machine,
but there can be many more <code>KV</code>s in the resulting <code>PCollection</code> than can fit into
the memory of a single machine.
<p>Example of use:
<pre><code>
PCollection&lt;KV&lt;String, Integer&gt;&gt; keyedValues = ...;
PCollection&lt;KV&lt;String, List&lt;Integer&gt;&gt;&gt; smallest10ValuesPerKey =
keyedValues.apply(Top.smallestPerKey(10));
</code></pre>
<p>By default, the <code>Coder</code> of the keys of the output <code>PCollection</code> is the same as
that of the keys of the input <code>PCollection</code>, and the <code>Coder</code> of the values of the
output <code>PCollection</code> is a <code>ListCoder</code> of the <code>Coder</code> of the values of the
input <code>PCollection</code>.
<p>See also <a href="../../../../../org/apache/beam/sdk/transforms/Top.html#largestPerKey-int-"><code>largestPerKey(int)</code></a>.
<p>See also <a href="../../../../../org/apache/beam/sdk/transforms/Top.html#perKey-int-ComparatorT-"><code>perKey(int, ComparatorT)</code></a>, which sorts values using a user-specified <code>Comparator</code>
function.
<p>See also <a href="../../../../../org/apache/beam/sdk/transforms/Top.html#of-int-ComparatorT-"><code>of(int, ComparatorT)</code></a>, <a href="../../../../../org/apache/beam/sdk/transforms/Top.html#smallest-int-"><code>smallest(int)</code></a>, and <a href="../../../../../org/apache/beam/sdk/transforms/Top.html#largest-int-"><code>largest(int)</code></a>, which take a <code>PCollection</code> and return the top elements.</div>
</li>
</ul>
<a name="largestPerKey-int-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>largestPerKey</h4>
<pre>public static&nbsp;&lt;K,V extends java.lang.Comparable&lt;V&gt;&gt;&nbsp;<a href="../../../../../org/apache/beam/sdk/transforms/Combine.PerKey.html" title="class in org.apache.beam.sdk.transforms">Combine.PerKey</a>&lt;K,V,java.util.List&lt;V&gt;&gt;&nbsp;largestPerKey(int&nbsp;count)</pre>
<div class="block">Returns a <code>PTransform</code> that takes an input <code>PCollection&lt;KV&lt;K, V&gt;&gt;</code> and returns a
<code>PCollection&lt;KV&lt;K, List&lt;V&gt;&gt;&gt;</code> that contains an output element mapping each distinct key
in the input <code>PCollection</code> to the largest <code>count</code> values associated with that key
in the input <code>PCollection&lt;KV&lt;K, V&gt;&gt;</code>, in decreasing order, sorted according to their
natural order.
<p>If there are fewer than <code>count</code> values associated with a particular key, then all
those values will be in the result mapping for that key, albeit in sorted order.
<p>All the values associated with a single key must fit into the memory of a single machine,
but there can be many more <code>KV</code>s in the resulting <code>PCollection</code> than can fit into
the memory of a single machine.
<p>Example of use:
<pre><code>
PCollection&lt;KV&lt;String, Integer&gt;&gt; keyedValues = ...;
PCollection&lt;KV&lt;String, List&lt;Integer&gt;&gt;&gt; largest10ValuesPerKey =
keyedValues.apply(Top.largestPerKey(10));
</code></pre>
<p>By default, the <code>Coder</code> of the keys of the output <code>PCollection</code> is the same as
that of the keys of the input <code>PCollection</code>, and the <code>Coder</code> of the values of the
output <code>PCollection</code> is a <code>ListCoder</code> of the <code>Coder</code> of the values of the
input <code>PCollection</code>.
<p>See also <a href="../../../../../org/apache/beam/sdk/transforms/Top.html#smallestPerKey-int-"><code>smallestPerKey(int)</code></a>.
<p>See also <a href="../../../../../org/apache/beam/sdk/transforms/Top.html#perKey-int-ComparatorT-"><code>perKey(int, ComparatorT)</code></a>, which sorts values using a user-specified <code>Comparator</code>
function.
<p>See also <a href="../../../../../org/apache/beam/sdk/transforms/Top.html#of-int-ComparatorT-"><code>of(int, ComparatorT)</code></a>, <a href="../../../../../org/apache/beam/sdk/transforms/Top.html#smallest-int-"><code>smallest(int)</code></a>, and <a href="../../../../../org/apache/beam/sdk/transforms/Top.html#largest-int-"><code>largest(int)</code></a>, which take a <code>PCollection</code> and return the top elements.</div>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</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">
<li><a href="../../../../../org/apache/beam/sdk/transforms/ToJson.html" title="class in org.apache.beam.sdk.transforms"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../../org/apache/beam/sdk/transforms/Top.Largest.html" title="class in org.apache.beam.sdk.transforms"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/beam/sdk/transforms/Top.html" target="_top">Frames</a></li>
<li><a href="Top.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All&nbsp;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>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>