| <!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 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 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 Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../../../../allclasses-noframe.html">All 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: </li> |
| <li><a href="#nested.class.summary">Nested</a> | </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li>Constr | </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"> </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 </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><<a href="../../../../../org/apache/beam/sdk/transforms/Top.Largest.html" title="type parameter in Top.Largest">T</a> extends java.lang.Comparable<? super <a href="../../../../../org/apache/beam/sdk/transforms/Top.Largest.html" title="type parameter in Top.Largest">T</a>>></span></code> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> |
| <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 </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><<a href="../../../../../org/apache/beam/sdk/transforms/Top.Natural.html" title="type parameter in Top.Natural">T</a> extends java.lang.Comparable<? super <a href="../../../../../org/apache/beam/sdk/transforms/Top.Natural.html" title="type parameter in Top.Natural">T</a>>></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 </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><<a href="../../../../../org/apache/beam/sdk/transforms/Top.Reversed.html" title="type parameter in Top.Reversed">T</a> extends java.lang.Comparable<? super <a href="../../../../../org/apache/beam/sdk/transforms/Top.Reversed.html" title="type parameter in Top.Reversed">T</a>>></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 </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><<a href="../../../../../org/apache/beam/sdk/transforms/Top.Smallest.html" title="type parameter in Top.Smallest">T</a> extends java.lang.Comparable<? super <a href="../../../../../org/apache/beam/sdk/transforms/Top.Smallest.html" title="type parameter in Top.Smallest">T</a>>></span></code> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> |
| <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 </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><<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<<a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="type parameter in Top.TopCombineFn">T</a>> & java.io.Serializable></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<T></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"> </span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static 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="colLast" scope="col">Method and Description</th> |
| </tr> |
| <tr id="i0" class="altColor"> |
| <td class="colFirst"><code>static <T extends java.lang.Comparable<T>><br><a href="../../../../../org/apache/beam/sdk/transforms/Combine.Globally.html" title="class in org.apache.beam.sdk.transforms">Combine.Globally</a><T,java.util.List<T>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/transforms/Top.html#largest-int-">largest</a></span>(int count)</code> |
| <div class="block">Returns a <code>PTransform</code> that takes an input <code>PCollection<T></code> and returns a <code>PCollection<List<T>></code> with a single element containing the largest <code>count</code> elements of |
| the input <code>PCollection<T></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><java.lang.Double,<a href="../../../../../org/apache/beam/sdk/transforms/Top.Natural.html" title="class in org.apache.beam.sdk.transforms">Top.Natural</a><java.lang.Double>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/transforms/Top.html#largestDoublesFn-int-">largestDoublesFn</a></span>(int 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 <T extends java.lang.Comparable<T>><br><a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms">Top.TopCombineFn</a><T,<a href="../../../../../org/apache/beam/sdk/transforms/Top.Natural.html" title="class in org.apache.beam.sdk.transforms">Top.Natural</a><T>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/transforms/Top.html#largestFn-int-">largestFn</a></span>(int 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><java.lang.Integer,<a href="../../../../../org/apache/beam/sdk/transforms/Top.Natural.html" title="class in org.apache.beam.sdk.transforms">Top.Natural</a><java.lang.Integer>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/transforms/Top.html#largestIntsFn-int-">largestIntsFn</a></span>(int 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><java.lang.Long,<a href="../../../../../org/apache/beam/sdk/transforms/Top.Natural.html" title="class in org.apache.beam.sdk.transforms">Top.Natural</a><java.lang.Long>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/transforms/Top.html#largestLongsFn-int-">largestLongsFn</a></span>(int 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 <K,V extends java.lang.Comparable<V>><br><a href="../../../../../org/apache/beam/sdk/transforms/Combine.PerKey.html" title="class in org.apache.beam.sdk.transforms">Combine.PerKey</a><K,V,java.util.List<V>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/transforms/Top.html#largestPerKey-int-">largestPerKey</a></span>(int count)</code> |
| <div class="block">Returns a <code>PTransform</code> that takes an input <code>PCollection<KV<K, V>></code> and returns a |
| <code>PCollection<KV<K, List<V>>></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<KV<K, V>></code>, in decreasing order, sorted according to their |
| natural order.</div> |
| </td> |
| </tr> |
| <tr id="i6" class="altColor"> |
| <td class="colFirst"><code>static <T,ComparatorT extends java.util.Comparator<T> & java.io.Serializable><br><a href="../../../../../org/apache/beam/sdk/transforms/Combine.Globally.html" title="class in org.apache.beam.sdk.transforms">Combine.Globally</a><T,java.util.List<T>></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 count, |
| ComparatorT compareFn)</code> |
| <div class="block">Returns a <code>PTransform</code> that takes an input <code>PCollection<T></code> and returns a <code>PCollection<List<T>></code> with a single element containing the largest <code>count</code> elements of |
| the input <code>PCollection<T></code>, in decreasing order, sorted using the given <code>Comparator<T></code>.</div> |
| </td> |
| </tr> |
| <tr id="i7" class="rowColor"> |
| <td class="colFirst"><code>static <K,V,ComparatorT extends java.util.Comparator<V> & java.io.Serializable><br><a href="../../../../../org/apache/beam/sdk/transforms/PTransform.html" title="class in org.apache.beam.sdk.transforms">PTransform</a><<a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values">PCollection</a><<a href="../../../../../org/apache/beam/sdk/values/KV.html" title="class in org.apache.beam.sdk.values">KV</a><K,V>>,<a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values">PCollection</a><<a href="../../../../../org/apache/beam/sdk/values/KV.html" title="class in org.apache.beam.sdk.values">KV</a><K,java.util.List<V>>>></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 count, |
| ComparatorT compareFn)</code> |
| <div class="block">Returns a <code>PTransform</code> that takes an input <code>PCollection<KV<K, V>></code> and returns a |
| <code>PCollection<KV<K, List<V>>></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<KV<K, V>></code>, in decreasing order, sorted using the given <code>Comparator<V></code>.</div> |
| </td> |
| </tr> |
| <tr id="i8" class="altColor"> |
| <td class="colFirst"><code>static <T extends java.lang.Comparable<T>><br><a href="../../../../../org/apache/beam/sdk/transforms/Combine.Globally.html" title="class in org.apache.beam.sdk.transforms">Combine.Globally</a><T,java.util.List<T>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/transforms/Top.html#smallest-int-">smallest</a></span>(int count)</code> |
| <div class="block">Returns a <code>PTransform</code> that takes an input <code>PCollection<T></code> and returns a <code>PCollection<List<T>></code> with a single element containing the smallest <code>count</code> elements of |
| the input <code>PCollection<T></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><java.lang.Double,<a href="../../../../../org/apache/beam/sdk/transforms/Top.Reversed.html" title="class in org.apache.beam.sdk.transforms">Top.Reversed</a><java.lang.Double>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/transforms/Top.html#smallestDoublesFn-int-">smallestDoublesFn</a></span>(int 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 <T extends java.lang.Comparable<T>><br><a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms">Top.TopCombineFn</a><T,<a href="../../../../../org/apache/beam/sdk/transforms/Top.Reversed.html" title="class in org.apache.beam.sdk.transforms">Top.Reversed</a><T>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/transforms/Top.html#smallestFn-int-">smallestFn</a></span>(int 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><java.lang.Integer,<a href="../../../../../org/apache/beam/sdk/transforms/Top.Reversed.html" title="class in org.apache.beam.sdk.transforms">Top.Reversed</a><java.lang.Integer>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/transforms/Top.html#smallestIntsFn-int-">smallestIntsFn</a></span>(int 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><java.lang.Long,<a href="../../../../../org/apache/beam/sdk/transforms/Top.Reversed.html" title="class in org.apache.beam.sdk.transforms">Top.Reversed</a><java.lang.Long>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/transforms/Top.html#smallestLongsFn-int-">smallestLongsFn</a></span>(int 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 <K,V extends java.lang.Comparable<V>><br><a href="../../../../../org/apache/beam/sdk/transforms/PTransform.html" title="class in org.apache.beam.sdk.transforms">PTransform</a><<a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values">PCollection</a><<a href="../../../../../org/apache/beam/sdk/values/KV.html" title="class in org.apache.beam.sdk.values">KV</a><K,V>>,<a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values">PCollection</a><<a href="../../../../../org/apache/beam/sdk/values/KV.html" title="class in org.apache.beam.sdk.values">KV</a><K,java.util.List<V>>>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/transforms/Top.html#smallestPerKey-int-">smallestPerKey</a></span>(int count)</code> |
| <div class="block">Returns a <code>PTransform</code> that takes an input <code>PCollection<KV<K, V>></code> and returns a |
| <code>PCollection<KV<K, List<V>>></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<KV<K, V>></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 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 <T,ComparatorT extends java.util.Comparator<T> & java.io.Serializable> <a href="../../../../../org/apache/beam/sdk/transforms/Combine.Globally.html" title="class in org.apache.beam.sdk.transforms">Combine.Globally</a><T,java.util.List<T>> of(int count, |
| ComparatorT compareFn)</pre> |
| <div class="block">Returns a <code>PTransform</code> that takes an input <code>PCollection<T></code> and returns a <code>PCollection<List<T>></code> with a single element containing the largest <code>count</code> elements of |
| the input <code>PCollection<T></code>, in decreasing order, sorted using the given <code>Comparator<T></code>. The <code>Comparator<T></code> must also be <code>Serializable</code>. |
| |
| <p>If <code>count</code> <code>></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<Student> students = ...; |
| PCollection<List<Student>> 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<T></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 <T extends java.lang.Comparable<T>> <a href="../../../../../org/apache/beam/sdk/transforms/Combine.Globally.html" title="class in org.apache.beam.sdk.transforms">Combine.Globally</a><T,java.util.List<T>> smallest(int count)</pre> |
| <div class="block">Returns a <code>PTransform</code> that takes an input <code>PCollection<T></code> and returns a <code>PCollection<List<T>></code> with a single element containing the smallest <code>count</code> elements of |
| the input <code>PCollection<T></code>, in increasing order, sorted according to their natural order. |
| |
| <p>If <code>count</code> <code>></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<Integer> values = ...; |
| PCollection<List<Integer>> 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<T></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 <T extends java.lang.Comparable<T>> <a href="../../../../../org/apache/beam/sdk/transforms/Combine.Globally.html" title="class in org.apache.beam.sdk.transforms">Combine.Globally</a><T,java.util.List<T>> largest(int count)</pre> |
| <div class="block">Returns a <code>PTransform</code> that takes an input <code>PCollection<T></code> and returns a <code>PCollection<List<T>></code> with a single element containing the largest <code>count</code> elements of |
| the input <code>PCollection<T></code>, in decreasing order, sorted according to their natural order. |
| |
| <p>If <code>count</code> <code>></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<Integer> values = ...; |
| PCollection<List<Integer>> 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<T></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 <T extends java.lang.Comparable<T>> <a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms">Top.TopCombineFn</a><T,<a href="../../../../../org/apache/beam/sdk/transforms/Top.Natural.html" title="class in org.apache.beam.sdk.transforms">Top.Natural</a><T>> largestFn(int 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 <a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms">Top.TopCombineFn</a><java.lang.Long,<a href="../../../../../org/apache/beam/sdk/transforms/Top.Natural.html" title="class in org.apache.beam.sdk.transforms">Top.Natural</a><java.lang.Long>> largestLongsFn(int 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 <a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms">Top.TopCombineFn</a><java.lang.Integer,<a href="../../../../../org/apache/beam/sdk/transforms/Top.Natural.html" title="class in org.apache.beam.sdk.transforms">Top.Natural</a><java.lang.Integer>> largestIntsFn(int 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 <a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms">Top.TopCombineFn</a><java.lang.Double,<a href="../../../../../org/apache/beam/sdk/transforms/Top.Natural.html" title="class in org.apache.beam.sdk.transforms">Top.Natural</a><java.lang.Double>> largestDoublesFn(int 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 <T extends java.lang.Comparable<T>> <a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms">Top.TopCombineFn</a><T,<a href="../../../../../org/apache/beam/sdk/transforms/Top.Reversed.html" title="class in org.apache.beam.sdk.transforms">Top.Reversed</a><T>> smallestFn(int 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 <a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms">Top.TopCombineFn</a><java.lang.Long,<a href="../../../../../org/apache/beam/sdk/transforms/Top.Reversed.html" title="class in org.apache.beam.sdk.transforms">Top.Reversed</a><java.lang.Long>> smallestLongsFn(int 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 <a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms">Top.TopCombineFn</a><java.lang.Integer,<a href="../../../../../org/apache/beam/sdk/transforms/Top.Reversed.html" title="class in org.apache.beam.sdk.transforms">Top.Reversed</a><java.lang.Integer>> smallestIntsFn(int 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 <a href="../../../../../org/apache/beam/sdk/transforms/Top.TopCombineFn.html" title="class in org.apache.beam.sdk.transforms">Top.TopCombineFn</a><java.lang.Double,<a href="../../../../../org/apache/beam/sdk/transforms/Top.Reversed.html" title="class in org.apache.beam.sdk.transforms">Top.Reversed</a><java.lang.Double>> smallestDoublesFn(int 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 <K,V,ComparatorT extends java.util.Comparator<V> & java.io.Serializable> <a href="../../../../../org/apache/beam/sdk/transforms/PTransform.html" title="class in org.apache.beam.sdk.transforms">PTransform</a><<a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values">PCollection</a><<a href="../../../../../org/apache/beam/sdk/values/KV.html" title="class in org.apache.beam.sdk.values">KV</a><K,V>>,<a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values">PCollection</a><<a href="../../../../../org/apache/beam/sdk/values/KV.html" title="class in org.apache.beam.sdk.values">KV</a><K,java.util.List<V>>>> perKey(int count, |
| ComparatorT compareFn)</pre> |
| <div class="block">Returns a <code>PTransform</code> that takes an input <code>PCollection<KV<K, V>></code> and returns a |
| <code>PCollection<KV<K, List<V>>></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<KV<K, V>></code>, in decreasing order, sorted using the given <code>Comparator<V></code>. The <code>Comparator<V></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<KV<School, Student>> studentsBySchool = ...; |
| PCollection<KV<School, List<Student>>> 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<V></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 <K,V extends java.lang.Comparable<V>> <a href="../../../../../org/apache/beam/sdk/transforms/PTransform.html" title="class in org.apache.beam.sdk.transforms">PTransform</a><<a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values">PCollection</a><<a href="../../../../../org/apache/beam/sdk/values/KV.html" title="class in org.apache.beam.sdk.values">KV</a><K,V>>,<a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values">PCollection</a><<a href="../../../../../org/apache/beam/sdk/values/KV.html" title="class in org.apache.beam.sdk.values">KV</a><K,java.util.List<V>>>> smallestPerKey(int count)</pre> |
| <div class="block">Returns a <code>PTransform</code> that takes an input <code>PCollection<KV<K, V>></code> and returns a |
| <code>PCollection<KV<K, List<V>>></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<KV<K, V>></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<KV<String, Integer>> keyedValues = ...; |
| PCollection<KV<String, List<Integer>>> 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 <K,V extends java.lang.Comparable<V>> <a href="../../../../../org/apache/beam/sdk/transforms/Combine.PerKey.html" title="class in org.apache.beam.sdk.transforms">Combine.PerKey</a><K,V,java.util.List<V>> largestPerKey(int count)</pre> |
| <div class="block">Returns a <code>PTransform</code> that takes an input <code>PCollection<KV<K, V>></code> and returns a |
| <code>PCollection<KV<K, List<V>>></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<KV<K, V>></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<KV<String, Integer>> keyedValues = ...; |
| PCollection<KV<String, List<Integer>>> 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 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 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 Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../../../../allclasses-noframe.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> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li><a href="#nested.class.summary">Nested</a> | </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| </body> |
| </html> |