chamikaramj commented on code in PR #31470:
URL: https://github.com/apache/beam/pull/31470#discussion_r1624829545
##########
sdks/java/core/src/main/java/org/apache/beam/sdk/values/PCollectionRowTuple.java:
##########
@@ -180,6 +181,22 @@ public PCollection<Row> get(String tag) {
return pcollection;
}
+ /**
+ * Like {@link #get(String)}, but is a convenience method to get a single
output without providing
+ * a tag for that output. Use only when there is a single output.
+ *
+ * <p>Throws {@link IllegalStateException} if more than one output exists in
the {@link
+ * PCollectionRowTuple}.
+ */
+ public PCollection<Row> getOutput() {
Review Comment:
May be call this `getOnlyPCollection()` since `PCollectionRowTuple` can be
used as input or output.
##########
sdks/java/managed/src/main/java/org/apache/beam/sdk/managed/Managed.java:
##########
@@ -194,7 +199,28 @@ public PCollectionRowTuple expand(PCollectionRowTuple
input) {
SchemaTransform underlyingTransform =
new
ManagedSchemaTransformProvider(getSupportedIdentifiers()).from(managedConfig);
- return input.apply(underlyingTransform);
+ return inputTuple.apply(underlyingTransform);
+ }
+
+ @VisibleForTesting
+ static PCollectionRowTuple resolveInput(PInput input) {
Review Comment:
Will it be possible to introduce a similar simplification for output so that
callers do not have to call `getOutput` when there's only one output
`PCollection` ?
--
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]