reuvenlax commented on code in PR #40543:
URL: https://github.com/apache/beam/pull/40543#discussion_r4618750761


##########
sdks/java/core/src/main/java/org/apache/beam/sdk/io/WriteFiles.java:
##########
@@ -579,8 +616,118 @@ public WriteFilesResult<DestinationT> 
expand(PCollection<UserT> input) {
         (getComputeNumShards() == null) ? null : 
input.apply(getComputeNumShards());
 
     boolean fixedSharding = getComputeNumShards() != null || 
getNumShardsProvider() != null;
+    // Records that take the grouped path, and files written directly (if any).
+    PCollection<UserT> groupedInput = input;
+    @Nullable PCollection<FileResult<DestinationT>> directFiles = null;
+    Long directWriteThreshold = getDirectWriteByteThreshold();
+    if (directWriteThreshold != null) {
+      List<String> disabledReasons = new ArrayList<>();
+      // Without a fixed shard count, bounded inputs already write each bundle 
directly.
+      if (input.isBounded() == IsBounded.BOUNDED && !fixedSharding) {

Review Comment:
   batch pipelines might rely on fixed sharding of N generating exactly N 
files, which I think will break here. Maybe we should always disable if in 
batch?



-- 
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]

Reply via email to