Skip to content

Commit

Permalink
Use built-in batch grouping transform
Browse files Browse the repository at this point in the history
  • Loading branch information
fbiville committed Apr 8, 2024
1 parent 980e7ab commit 6409955
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 247 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import com.google.common.annotations.VisibleForTesting;
import java.util.Map;
import java.util.Set;
import org.apache.beam.sdk.transforms.GroupByKey;
import org.apache.beam.sdk.transforms.GroupIntoBatches;
import org.apache.beam.sdk.transforms.PTransform;
import org.apache.beam.sdk.transforms.ParDo;
import org.apache.beam.sdk.transforms.SerializableFunction;
Expand Down Expand Up @@ -104,8 +104,7 @@ public PCollection<Row> expand(@NonNull PCollection<Row> input) {

return input
.apply("Create KV pairs", CreateKvTransform.of(parallelism))
.apply("Group by keys", GroupByKey.create())
.apply("Split into batches", ParDo.of(SplitIntoBatches.of(batchSize)))
.apply("Group into batches", GroupIntoBatches.ofSize(batchSize))
.apply(target.getSequence() + ": Neo4j write " + target.getName(), ParDo.of(neo4jUnwindFn))
.setRowSchema(input.getSchema());
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 6409955

Please sign in to comment.