kennknowles commented on a change in pull request #15998:
URL: https://github.com/apache/beam/pull/15998#discussion_r750622496
##########
File path:
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/TagWithUniqueIds.java
##########
@@ -38,15 +39,32 @@
private transient String randomUUID;
private transient long sequenceNo = 0L;
+ private final SerializableFunction<ElementT, String> elementToId;
Review comment:
`@Nullable`
##########
File path:
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/StreamingWriteTables.java
##########
@@ -339,14 +402,17 @@ public WriteResult
expand(PCollection<KV<TableDestination, ElementT>> input) {
input
.apply("ShardTableWrites", ParDo.of(new
GenerateShardedTable<>(numShards)))
.setCoder(KvCoder.of(ShardedKeyCoder.of(StringUtf8Coder.of()),
elementCoder))
- .apply("TagWithUniqueIds", ParDo.of(new TagWithUniqueIds<>()))
+ .apply("TagWithUniqueIds", ParDo.of(new
TagWithUniqueIds<>(toUniqueId)))
.setCoder(
KvCoder.of(
ShardedKeyCoder.of(StringUtf8Coder.of()),
TableRowInfoCoder.of(elementCoder)));
+ if (!skipReshuffle) {
+ shardedTagged = shardedTagged.apply(Reshuffle.of());
Review comment:
My preference would be to require the unique id function if we skip the
reshuffle, otherwise we get duplicate elements, right? Prefer to have no
codepath that is easily incorrect. Is there a specific reason this doesn't work?
--
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]