apache / apache/beam

Mismatch in event publish_time

Open
#21,600 1 comment 1 reaction 0 assignees View on GitHub
beam-community bug P2 python
Dominant language
Java
Stars
8.7k
Forks
4.7k
Avg merge
1d 20h
Merged PRs (30d)
196

Description

below is the example code, where we are trying to get the publish_time of the pubsub message in our DoFn(). It seems the type has changed in the version of apache beam starting 2.36.0. However, I was not able to find any release notes that talk about this change. Any reference will be helpful.

```

class ProtoToDictDoFn(beam.DoFn):
def process(self, element, publish_time=beam.DoFn.TimestampParam):

"""
element is type PubsubMessage(),
"""
print('-------------')
print(type(element.publish_time))

print(element.publish_time)
print('-------------')

Output:
— for version 2.35.0 —

seconds: 1652814206
nanos: 417000000

— for version >=
2.36.0 —

2022-05-17 19:02:06.314000+00:00

```

Which seems to be an issue. As per the [google pubsub documentation publish time should be type "google.protobuf.timestamp_pb2.Timestamp"](https://github.com/googleapis/python-pubsub/blob/main/google/pubsub_v1/types/pubsub.py#L232)

Any clue, what has changed or caused this issue?

Imported from Jira [BEAM-14482](https://issues.apache.org/jira/browse/BEAM-14482). Original Jira may contain additional context.
Reported by: daljeet.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.