github-actions[bot] commented on code in PR #41023:
URL: https://github.com/apache/beam/pull/41023#discussion_r4485379636
##########
sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/GroupIntoBatches.java:
##########
@@ -498,7 +526,8 @@ public void processElement(
LOG.debug("*** BATCH *** Add element for window {} ", window);
if (shouldCareAboutWeight) {
final long elementWeight = weigher.apply(element.getValue());
- if (elementWeight + storedBatchSizeBytes.read() > batchSizeBytes) {
+ if (storedBatchSizeBytes.read() > 0
+ && elementWeight + storedBatchSizeBytes.read() > batchSizeBytes) {
Review Comment:
**🟢 Low**: `storedBatchSizeBytes.read()` is called twice consecutively in
this condition. Consider reading it once into a local variable (e.g., `long
currentBatchSizeBytes = storedBatchSizeBytes.read();`) to avoid redundant state
reads.
##########
sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/GroupIntoBatches.java:
##########
@@ -78,13 +77,13 @@
* PCollection<KV<String, Iterable<String>>> batched = input
* .apply(GroupIntoBatches.<String, String>ofSize(batchSize))
* .setCoder(KvCoder.of(StringUtf8Coder.of(),
IterableCoder.of(StringUtf8Coder.of())))
- * .apply(ParDo.of(new DoFn<KV<String, Iterable<String>>, KV<String,
String>>() }{
- * {@code @ProcessElement
+ * .apply(ParDo.of(new DoFn<KV<String, Iterable<String>>, KV<String,
String>>() {
+ * @ProcessElement
* public void processElement(@Element KV<String, Iterable<String>>
element,
* OutputReceiver<KV<String, String>> r) {
* r.output(KV.of(element.getKey(),
callWebService(element.getValue())));
Review Comment:
**🟠High**: Removing the extra braces on lines 78 and 84 leaves the `{@code`
tag opened on line 72 (`* <pre>{@code`) unclosed at `</pre>`. Additionally,
standard `javadoc` parses any line beginning with `* @...` (such as `*
@ProcessElement` on line 79) as a Javadoc block tag even inside `{@code ...}`,
which triggers both an `unknown tag: ProcessElement` and an `unclosed inline
tag` error during `:sdks:java:core:javadoc`. Ensure `{@code` is properly closed
(e.g., `}</pre>`) and that `@ProcessElement` is not parsed as a block tag by
`javadoc`.
```suggestion
* }));}
```
--
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]