tvalentyn commented on a change in pull request #14607:
URL: https://github.com/apache/beam/pull/14607#discussion_r621496835
##########
File path:
sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/PTransform.java
##########
@@ -178,6 +179,34 @@ public String getName() {
return name != null ? name : getKindString();
}
+ /**
+ * Sets resource hints for the transform.
+ *
+ * @param resourceHints a {@link ResourceHints} instance.
+ * @return a reference to the same transfrom instance.
+ * <p>For example:
+ * <pre>{@code
+ * Pipeline p = ...
+ * ...
+ * p.apply(new
SomeTransform().setResourceHints(ResourceHints.create().withMinRam("6 GiB")))
+ * ...
+ *
+ * }</pre>
+ */
+ public PTransform<InputT, OutputT> setResourceHints(ResourceHints
resourceHints) {
+ this.resourceHints = resourceHints;
+ return this;
+ }
+
+ /** Returns resource hints set on the transform. */
+ public ResourceHints getResourceHints() {
+ if (resourceHints == null) {
Review comment:
I think we can make initialization in the field declaration. We needed
this pattern in Python since Python (unlike Java) does not call superclass
constructor by default.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]