beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Work logged] (BEAM-4461) Create a library of useful transforms that use schemas
Date Wed, 05 Sep 2018 18:36:00 GMT

     [ https://issues.apache.org/jira/browse/BEAM-4461?focusedWorklogId=141487&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-141487
]

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_r215378279
 
 

 ##########
 File path: sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/CombineFns.java
 ##########
 @@ -272,6 +301,60 @@ private ComposedCombineFn(
               .addAll(extractInputFns)
               .add(extractInputFn)
               .build(),
+          ImmutableList.<Optional<Coder>>builder()
+              .addAll(combineInputCoders)
+              .add(Optional.absent())
+              .build(),
+          ImmutableList.<CombineFnWithContext<?, ?, ?>>builder()
+              .addAll(fnsWithContext)
+              .add(combineFn)
+              .build(),
+          ImmutableList.<TupleTag<?>>builder().addAll(outputTags).add(outputTag).build());
+    }
+
+    /** Returns a {@link ComposedCombineFn} with an additional {@link CombineFn}. */
+    public <InputT, OutputT> ComposedCombineFn<DataT> with(
+        SimpleFunction<DataT, InputT> extractInputFn,
+        Coder combineInputCoder,
+        CombineFn<InputT, ?, OutputT> combineFn,
+        TupleTag<OutputT> outputTag) {
+      checkUniqueness(outputTags, outputTag);
+      return new ComposedCombineFn<>(
+          ImmutableList.<SerializableFunction<DataT, ?>>builder()
+              .addAll(extractInputFns)
+              .add(extractInputFn)
+              .build(),
+          ImmutableList.<Optional<Coder>>builder()
+              .addAll(combineInputCoders)
+              .add(Optional.of(combineInputCoder))
+              .build(),
+          ImmutableList.<CombineFn<?, ?, ?>>builder().addAll(combineFns).add(combineFn).build(),
+          ImmutableList.<TupleTag<?>>builder().addAll(outputTags).add(outputTag).build());
+    }
+
+    /**
+     * Returns a {@link ComposedCombineFnWithContext} with an additional {@link
+     * CombineFnWithContext}.
+     */
+    public <InputT, OutputT> ComposedCombineFnWithContext<DataT> with(
+        SimpleFunction<DataT, InputT> extractInputFn,
+        Coder combineInputCoder,
+        CombineFnWithContext<InputT, ?, OutputT> combineFn,
+        TupleTag<OutputT> outputTag) {
+      checkUniqueness(outputTags, outputTag);
+      List<CombineFnWithContext<Object, Object, Object>> fnsWithContext = Lists.newArrayList();
+      for (CombineFn<Object, Object, Object> fn : combineFns) {
+        fnsWithContext.add(CombineFnUtil.toFnWithContext(fn));
 
 Review comment:
   nit: can this be rewritten as `combineFns.stream().map(CombilneFnUtil::toFnWithContext).collect(toList())`?

----------------------------------------------------------------
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:
users@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 141487)
    Time Spent: 5h 40m  (was: 5.5h)

> 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 40m
>  Remaining Estimate: 0h
>
> e.g. JoinBy(fields). Project, Filter, etc.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message