scwhittle commented on code in PR #39487:
URL: https://github.com/apache/beam/pull/39487#discussion_r3677734070
##########
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/DataflowOutputCounter.java:
##########
@@ -41,20 +42,57 @@ public class DataflowOutputCounter implements
ElementCounter {
private OutputObjectAndByteCounter objectAndByteCounter;
private Counter<Long, ?> elementCount;
+ private final boolean isStreaming;
+
+ public static DataflowOutputCounter create(
+ String outputName,
+ ElementByteSizeObservable<?> elementByteSizeObservable,
+ CounterFactory counterFactory,
+ NameContext nameContext,
+ boolean isStreaming) {
+ return new DataflowOutputCounter(
+ outputName, elementByteSizeObservable, counterFactory, nameContext,
isStreaming);
+ }
+
+ public static DataflowOutputCounter create(
+ String outputName,
+ CounterFactory counterFactory,
+ NameContext nameContext,
+ boolean isStreaming) {
+ return create(outputName, null, counterFactory, nameContext, isStreaming);
+ }
public DataflowOutputCounter(
String outputName, CounterFactory counterFactory, NameContext
nameContext) {
- this(outputName, null, counterFactory, nameContext);
+ this(outputName, null, counterFactory, nameContext, false);
+ }
+
+ public DataflowOutputCounter(
+ String outputName,
+ CounterFactory counterFactory,
+ NameContext nameContext,
+ boolean isStreaming) {
+ this(outputName, null, counterFactory, nameContext, isStreaming);
}
public DataflowOutputCounter(
String outputName,
ElementByteSizeObservable<?> elementByteSizeObservable,
CounterFactory counterFactory,
NameContext nameContext) {
- objectAndByteCounter =
+ this(outputName, elementByteSizeObservable, counterFactory, nameContext,
false);
+ }
+
+ public DataflowOutputCounter(
Review Comment:
can we consolidate to just a single private constructor and just have the
multiple create factories?
I think this class could be marked with Internal annotation as well
##########
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/DataflowOutputCounter.java:
##########
@@ -63,15 +101,42 @@ public void update(Object elem) throws Exception {
objectAndByteCounter.update(elem);
long windowsSize = ((WindowedValue<?>) elem).getWindows().size();
if (windowsSize == 0) {
- // GroupingShuffleReader produces ValueInEmptyWindows.
- // For now, we count the element at least once to keep the current
counter
- // behavior.
- elementCount.addValue(1L);
+ updateEmptyWindows((WindowedValue<?>) elem);
} else {
+ // Standard WindowedValue.
elementCount.addValue(windowsSize);
}
}
+ protected void updateEmptyWindows(WindowedValue<?> elem) {
Review Comment:
think this could be private now
##########
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/IntrinsicMapTaskExecutorFactory.java:
##########
@@ -346,6 +348,11 @@ OperationNode createFlattenOperation(
*/
static Function<Node, Node> createOutputReceiversTransform(
Review Comment:
can this be removed and just have the 3 param version? since it's internal
to runner?
--
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]