[
https://issues.apache.org/jira/browse/BEAM-4461?focusedWorklogId=141489&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-141489
]
ASF GitHub Bot logged work on BEAM-4461:
----------------------------------------
Author: ASF GitHub Bot
Created on: 05/Sep/18 18:35
Start Date: 05/Sep/18 18:35
Worklog Time Spent: 10m
Work Description: akedin commented on a change in pull request #6318:
[BEAM-4461] Some fixes to Combiners needed for Schema support.
URL: https://github.com/apache/beam/pull/6318#discussion_r215381299
##########
File path: sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Top.java
##########
@@ -168,7 +168,40 @@ private Top() {
* {@code PCollection} of {@code KV}s and return the top values associated
with each key.
*/
public static <T extends Comparable<T>> Combine.Globally<T, List<T>>
largest(int count) {
- return Combine.globally(new TopCombineFn<>(count, new Natural<T>()));
+ return Combine.globally(largestFn(count));
+ }
+
+ /** Returns a {@link TopCombineFn} that aggregates the largest count values.
*/
+ public static <T extends Comparable<T>> TopCombineFn<T, Natural<T>>
largestFn(int count) {
+ return new TopCombineFn<T, Natural<T>>(count, new Natural<T>()) {};
+ }
+ /** Returns a {@link TopCombineFn} that aggregates the largest count long
values. */
+ public static TopCombineFn<Long, Natural<Long>> largestLongsFn(int count) {
+ return new TopCombineFn<Long, Natural<Long>>(count, new Natural<Long>())
{};
Review comment:
can java infer more of `<>`? E.g. `new TopCombineFn<>(count, new
Natural<Long>()) {};`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 141489)
Time Spent: 5h 50m (was: 5h 40m)
> Create a library of useful transforms that use schemas
> ------------------------------------------------------
>
> Key: BEAM-4461
> URL: https://issues.apache.org/jira/browse/BEAM-4461
> Project: Beam
> Issue Type: Sub-task
> Components: sdk-java-core
> Reporter: Reuven Lax
> Assignee: Reuven Lax
> Priority: Major
> Time Spent: 5h 50m
> Remaining Estimate: 0h
>
> e.g. JoinBy(fields). Project, Filter, etc.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)