ahmedabu98 commented on code in PR #38490:
URL: https://github.com/apache/beam/pull/38490#discussion_r3276020167
##########
sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/DoFn.java:
##########
@@ -188,6 +189,25 @@ public abstract class WindowedContext {
*/
public abstract void outputWithTimestamp(OutputT output, Instant
timestamp);
+ /**
+ * Adds the given element to the main output {@code PCollection}, with the
given {@link
+ * ValueKind}.
+ *
+ * <p>Once passed to {@code outputWithKind} the element should not be
modified in any way.
+ *
+ * <p>If invoked from {@link ProcessElement}, the output element will have
the same windowing
+ * metadata as the input element.
+ *
+ * <p>If invoked from {@link StartBundle} or {@link FinishBundle}, this
will attempt to use the
+ * {@link org.apache.beam.sdk.transforms.windowing.WindowFn} of the input
{@code PCollection} to
+ * determine what windows the element should be in, throwing an exception
if the {@code
+ * WindowFn} attempts to access any information about the input element.
+ *
+ * <p><i>Note:</i> A splittable {@link DoFn} is not allowed to output from
{@link StartBundle}
+ * or {@link FinishBundle} methods.
+ */
+ public abstract void outputWithKind(OutputT output, ValueKind kind);
Review Comment:
Done
##########
sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/DoFn.java:
##########
@@ -419,13 +453,31 @@ default void outputWithTimestamp(T value, Instant
timestamp) {
builder(value).setTimestamp(timestamp).output();
}
+ default void outputWithKind(T value, ValueKind valueKind) {
+ builder(value).setValueKind(valueKind).output();
+ }
+
default void outputWindowedValue(
T value,
Instant timestamp,
Collection<? extends BoundedWindow> windows,
PaneInfo paneInfo) {
builder(value).setTimestamp(timestamp).setWindows(windows).setPaneInfo(paneInfo).output();
}
+
+ default void outputWindowedValue(
Review Comment:
Done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]