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-3979) New DoFn should allow injecting of all parameters in ProcessContext
Date Mon, 23 Apr 2018 21:41:00 GMT

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

ASF GitHub Bot logged work on BEAM-3979:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 23/Apr/18 21:40
            Start Date: 23/Apr/18 21:40
    Worklog Time Spent: 10m 
      Work Description: reuvenlax commented on a change in pull request #4989: [BEAM-3979]
Start completing the new DoFn vision: plumb context parameters into process functions.
URL: https://github.com/apache/beam/pull/4989#discussion_r183546263
 
 

 ##########
 File path: sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/DoFnOutputReceivers.java
 ##########
 @@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.beam.sdk.transforms;
+
+import javax.annotation.Nullable;
+import org.apache.beam.sdk.transforms.DoFn.MultiOutputReceiver;
+import org.apache.beam.sdk.transforms.DoFn.OutputReceiver;
+import org.apache.beam.sdk.values.TupleTag;
+import org.joda.time.Instant;
+
+/**
+ * Common {@link OutputReceiver} and {@link MultiOutputReceiver} classes.
+ */
+public class DoFnOutputReceivers {
+  /**
+   * A {@link OutputReceiver} that delegates to a {@link DoFn.WindowedContext}.
+   */
+  public static class WindowedContextOutputReceiver<T> implements OutputReceiver<T>
{
+    DoFn<?, ?>.WindowedContext context;
+    @Nullable TupleTag<T> outputTag;
+    public WindowedContextOutputReceiver(DoFn<?, ?>.WindowedContext context,
 
 Review comment:
   <!--thread_id:cc_183501229_t; commit:e7163d592d424a480ae9071c770022129d401905; resolved:1-->
   <!--section:context-quote-->
   > **jkff** wrote:
   > Probably would be better to package these under static factory functions.
   
   <!--section:body-->
   Done.

----------------------------------------------------------------
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: 94317)

> New DoFn should allow injecting of all parameters in ProcessContext
> -------------------------------------------------------------------
>
>                 Key: BEAM-3979
>                 URL: https://issues.apache.org/jira/browse/BEAM-3979
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-java-core
>    Affects Versions: 2.4.0
>            Reporter: Reuven Lax
>            Assignee: Reuven Lax
>            Priority: Major
>             Fix For: 2.5.0
>
>          Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> This was intended in the past, but never completed. Ideally all primitive parameters
in ProcessContext should be injectable, and OutputReceiver parameters can be used to collection
output. So, we should be able to write a DoFn as follows
> @ProcessElement
> public void process(@Element String word, OutputReceiver<String> receiver) {
>   receiver.output(word.toUpperCase());
> }



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

Mime
View raw message