6161import org .apache .beam .sdk .values .PCollectionView ;
6262import org .apache .beam .sdk .values .Row ;
6363import org .apache .beam .sdk .values .TupleTag ;
64+ import org .apache .beam .sdk .values .ValueKind ;
6465import org .apache .beam .sdk .values .WindowedValue ;
6566import org .apache .beam .sdk .values .WindowedValues ;
6667import org .apache .beam .sdk .values .WindowingStrategy ;
@@ -415,6 +416,11 @@ public CausedByDrain causedByDrain() {
415416 return elem .causedByDrain ();
416417 }
417418
419+ @ Override
420+ public ValueKind valueKind () {
421+ return elem .getValueKind ();
422+ }
423+
418424 @ Override
419425 public <T > T sideInput (PCollectionView <T > view ) {
420426 checkNotNull (view , "View passed to sideInput cannot be null" );
@@ -438,6 +444,11 @@ public void outputWithTimestamp(OutputT output, Instant timestamp) {
438444 outputWithTimestamp (mainOutputTag , output , timestamp );
439445 }
440446
447+ @ Override
448+ public void outputWithKind (OutputT output , ValueKind kind ) {
449+ outputWithKind (mainOutputTag , output , kind );
450+ }
451+
441452 @ Override
442453 public void outputWindowedValue (
443454 OutputT output ,
@@ -447,6 +458,15 @@ public void outputWindowedValue(
447458 outputWindowedValue (mainOutputTag , output , timestamp , windows , paneInfo );
448459 }
449460
461+ public void outputWindowedValue (
462+ OutputT output ,
463+ Instant timestamp ,
464+ Collection <? extends BoundedWindow > windows ,
465+ PaneInfo paneInfo ,
466+ ValueKind valueKind ) {
467+ outputWindowedValue (mainOutputTag , output , timestamp , windows , paneInfo , valueKind );
468+ }
469+
450470 @ Override
451471 public <T > void output (TupleTag <T > tag , T output ) {
452472 checkNotNull (tag , "Tag passed to output cannot be null" );
@@ -471,6 +491,20 @@ public <T> void outputWithTimestamp(TupleTag<T> tag, T output, Instant timestamp
471491 outputWindowedValue (tag , output , timestamp , elem .getWindows (), elem .getPaneInfo ());
472492 }
473493
494+ @ Override
495+ public <T > void outputWithKind (TupleTag <T > tag , T output , ValueKind kind ) {
496+ checkNotNull (tag , "Tag passed to outputWithKind cannot be null" );
497+ builderSupplier
498+ .builder (output )
499+ .setValueKind (kind )
500+ .setReceiver (
501+ wv -> {
502+ checkTimestamp (elem .getTimestamp (), wv .getTimestamp ());
503+ SimpleDoFnRunner .this .outputWindowedValue (tag , wv );
504+ })
505+ .output ();
506+ }
507+
474508 @ Override
475509 public <T > void outputWindowedValue (
476510 TupleTag <T > tag ,
@@ -491,6 +525,27 @@ public <T> void outputWindowedValue(
491525 .output ();
492526 }
493527
528+ public <T > void outputWindowedValue (
529+ TupleTag <T > tag ,
530+ T output ,
531+ Instant timestamp ,
532+ Collection <? extends BoundedWindow > windows ,
533+ PaneInfo paneInfo ,
534+ ValueKind valueKind ) {
535+ builderSupplier
536+ .builder (output )
537+ .setTimestamp (timestamp )
538+ .setWindows (windows )
539+ .setPaneInfo (paneInfo )
540+ .setValueKind (valueKind )
541+ .setReceiver (
542+ wv -> {
543+ checkTimestamp (elem .getTimestamp (), wv .getTimestamp ());
544+ SimpleDoFnRunner .this .outputWindowedValue (tag , wv );
545+ })
546+ .output ();
547+ }
548+
494549 @ Override
495550 public Instant timestamp () {
496551 return elem .getTimestamp ();
@@ -581,6 +636,11 @@ public CausedByDrain causedByDrain(DoFn<InputT, OutputT> doFn) {
581636 return elem .causedByDrain ();
582637 }
583638
639+ @ Override
640+ public ValueKind valueKind (DoFn <InputT , OutputT > doFn ) {
641+ return elem .getValueKind ();
642+ }
643+
584644 @ Override
585645 public String timerId (DoFn <InputT , OutputT > doFn ) {
586646 throw new UnsupportedOperationException (
@@ -862,6 +922,11 @@ public CausedByDrain causedByDrain(DoFn<InputT, OutputT> doFn) {
862922 return causedByDrain ;
863923 }
864924
925+ @ Override
926+ public ValueKind valueKind (DoFn <InputT , OutputT > doFn ) {
927+ throw new UnsupportedOperationException ("ValueKind parameters are not supported." );
928+ }
929+
865930 @ Override
866931 public String timerId (DoFn <InputT , OutputT > doFn ) {
867932 return timerId ;
@@ -1008,6 +1073,11 @@ public void outputWithTimestamp(OutputT output, Instant timestamp) {
10081073 outputWithTimestamp (mainOutputTag , output , timestamp );
10091074 }
10101075
1076+ @ Override
1077+ public void outputWithKind (OutputT output , ValueKind kind ) {
1078+ outputWithKind (mainOutputTag , output , kind );
1079+ }
1080+
10111081 @ Override
10121082 public void outputWindowedValue (
10131083 OutputT output ,
@@ -1030,6 +1100,12 @@ public <T> void outputWithTimestamp(TupleTag<T> tag, T output, Instant timestamp
10301100 tag , output , timestamp , Collections .singleton (window ()), PaneInfo .NO_FIRING );
10311101 }
10321102
1103+ @ Override
1104+ public <T > void outputWithKind (TupleTag <T > tag , T output , ValueKind kind ) {
1105+ outputWindowedValue (
1106+ tag , output , timestamp (), Collections .singleton (window ()), PaneInfo .NO_FIRING , kind );
1107+ }
1108+
10331109 @ Override
10341110 public <T > void outputWindowedValue (
10351111 TupleTag <T > tag ,
@@ -1048,6 +1124,25 @@ public <T> void outputWindowedValue(
10481124 .output ();
10491125 }
10501126
1127+ public <T > void outputWindowedValue (
1128+ TupleTag <T > tag ,
1129+ T output ,
1130+ Instant timestamp ,
1131+ Collection <? extends BoundedWindow > windows ,
1132+ PaneInfo paneInfo ,
1133+ ValueKind kind ) {
1134+ checkTimestamp (timestamp (), timestamp );
1135+
1136+ builderSupplier
1137+ .builder (output )
1138+ .setTimestamp (timestamp )
1139+ .setWindows (windows )
1140+ .setPaneInfo (paneInfo )
1141+ .setValueKind (kind )
1142+ .setReceiver (wv -> SimpleDoFnRunner .this .outputWindowedValue (tag , wv ))
1143+ .output ();
1144+ }
1145+
10511146 @ Override
10521147 public void outputWindowedValue (WindowedValue <OutputT > windowedValue ) {
10531148 outputWindowedValue (mainOutputTag , windowedValue );
@@ -1177,6 +1272,11 @@ public TimeDomain timeDomain(DoFn<InputT, OutputT> doFn) {
11771272 "Cannot access time domain outside of @ProcessTimer method." );
11781273 }
11791274
1275+ @ Override
1276+ public ValueKind valueKind (DoFn <InputT , OutputT > doFn ) {
1277+ throw new UnsupportedOperationException ("ValueKind parameters are not supported." );
1278+ }
1279+
11801280 @ Override
11811281 public KeyT key () {
11821282 return key ;
@@ -1279,6 +1379,11 @@ public void outputWithTimestamp(OutputT output, Instant timestamp) {
12791379 outputWithTimestamp (mainOutputTag , output , timestamp );
12801380 }
12811381
1382+ @ Override
1383+ public void outputWithKind (OutputT output , ValueKind kind ) {
1384+ outputWithKind (mainOutputTag , output , kind );
1385+ }
1386+
12821387 @ Override
12831388 public void outputWindowedValue (
12841389 OutputT output ,
@@ -1301,6 +1406,17 @@ public <T> void outputWithTimestamp(TupleTag<T> tag, T output, Instant timestamp
13011406 tag , output , timestamp , Collections .singleton (window ()), PaneInfo .NO_FIRING );
13021407 }
13031408
1409+ @ Override
1410+ public <T > void outputWithKind (TupleTag <T > tag , T output , ValueKind kind ) {
1411+ outputWindowedValue (
1412+ tag ,
1413+ output ,
1414+ timestamp (SimpleDoFnRunner .this .fn ),
1415+ Collections .singleton (window ()),
1416+ PaneInfo .NO_FIRING ,
1417+ kind );
1418+ }
1419+
13041420 @ Override
13051421 public <T > void outputWindowedValue (
13061422 TupleTag <T > tag ,
@@ -1318,6 +1434,24 @@ public <T> void outputWindowedValue(
13181434 .output ();
13191435 }
13201436
1437+ public <T > void outputWindowedValue (
1438+ TupleTag <T > tag ,
1439+ T output ,
1440+ Instant timestamp ,
1441+ Collection <? extends BoundedWindow > windows ,
1442+ PaneInfo paneInfo ,
1443+ ValueKind kind ) {
1444+ checkTimestamp (this .timestamp , timestamp );
1445+ builderSupplier
1446+ .builder (output )
1447+ .setTimestamp (timestamp )
1448+ .setWindows (windows )
1449+ .setPaneInfo (paneInfo )
1450+ .setValueKind (kind )
1451+ .setReceiver (wv -> SimpleDoFnRunner .this .outputWindowedValue (tag , wv ))
1452+ .output ();
1453+ }
1454+
13211455 @ Override
13221456 public void outputWindowedValue (WindowedValue <OutputT > windowedValue ) {
13231457 outputWindowedValue (mainOutputTag , windowedValue );
0 commit comments