forked from apache/beam
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add "DoFn Additional Parameters" Java kata
- Loading branch information
Showing
4 changed files
with
175 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
36 changes: 36 additions & 0 deletions
36
...rameters/src/org/apache/beam/learning/katas/coretransforms/dofnadditionalparams/Task.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* 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:https://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.learning.katas.coretransforms.dofnadditionalparams; | ||
|
||
import org.apache.beam.sdk.Pipeline; | ||
import org.apache.beam.sdk.options.PipelineOptions; | ||
import org.apache.beam.sdk.options.PipelineOptionsFactory; | ||
|
||
public class Task { | ||
|
||
public static void main(String[] args) { | ||
PipelineOptions options = PipelineOptionsFactory.fromArgs(args).create(); | ||
Pipeline pipeline = Pipeline.create(options); | ||
|
||
|
||
|
||
pipeline.run(); | ||
} | ||
|
||
} |
52 changes: 52 additions & 0 deletions
52
...atas/java/Core Transforms/DoFn Additional Parameters/DoFn Additional Parameters/task.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<!-- | ||
~ 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:https://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. | ||
--> | ||
|
||
<html> | ||
<h2>DoFn Additional Parameters</h2> | ||
<p> | ||
In addition to the element and the OutputReceiver, Beam will populate other parameters to your | ||
DoFn’s @ProcessElement method. Any combination of these parameters can be added to your process | ||
method in any order. | ||
</p> | ||
<div> | ||
<ul> | ||
<li> | ||
<b>Timestamp</b>: To access the timestamp of an input element, add a parameter annotated with | ||
@Timestamp of type Instant | ||
</li> | ||
<li> | ||
<b>Window</b>: To access the window an input element falls into, add a parameter of the type of the | ||
window used for the input PCollection. | ||
</li> | ||
<li> | ||
<b>PaneInfo</b>: When triggers are used, Beam provides a PaneInfo object that contains information | ||
about the current firing. Using PaneInfo you can determine whether this is an early or a | ||
late firing, and how many times this window has already fired for this key. | ||
</li> | ||
<li> | ||
<b>PipelineOptions</b>: The PipelineOptions for the current pipeline can always be accessed in a | ||
process method by adding it as a parameter. | ||
</li> | ||
</ul> | ||
</div> | ||
<p> | ||
Refer to the Beam Programming Guide | ||
<a href="https://beam.apache.org/documentation/programming-guide/#other-dofn-parameters"> | ||
"Accessing additional parameters in your DoFn"</a> section for more information. | ||
</p> | ||
</html> |
22 changes: 22 additions & 0 deletions
22
...ers/test/org/apache/beam/learning/katas/coretransforms/dofnadditionalparams/TaskTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* 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:https://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.learning.katas.coretransforms.dofnadditionalparams; | ||
|
||
public class TaskTest { | ||
} |