ahmedabu98 commented on code in PR #28624:
URL: https://github.com/apache/beam/pull/28624#discussion_r1335227012
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableWriteSchemaTransformProvider.java:
##########
@@ -179,12 +179,13 @@ public KV<ByteString, Iterable<Mutation>> apply(Row row) {
.setColumnQualifier(
ByteString.copyFrom(ofNullable(mutation.get("column_qualifier")).get()))
.setFamilyNameBytes(
-
ByteString.copyFrom(ofNullable(mutation.get("family_name")).get()));
- if (mutation.containsKey("timestamp_micros")) {
- setMutation =
- setMutation.setTimestampMicros(
-
Longs.fromByteArray(ofNullable(mutation.get("timestamp_micros")).get()));
- }
+
ByteString.copyFrom(ofNullable(mutation.get("family_name")).get()))
+ // Use timestamp if provided, else default to -1 (current
Bigtable server time)
+ .setTimestampMicros(
Review Comment:
Could definitely add those checks, but want to point out that the input
mutation map object is constructed here:
https://github.com/apache/beam/blob/68cf802626a1ef7d41aadca13d009f0d1b609b33/sdks/python/apache_beam/io/gcp/bigtableio.py#L249-L258
This process is internal, so we always expect these fields to exist (at
least if we're talking xlang. I'm not aware of other ways SchemaTransforms are
used). Users wouldn't be constructing their own Beam Row mutations
--
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]