A1K28 commented on code in PR #35766:
URL: https://github.com/apache/beam/pull/35766#discussion_r2248642320
##########
sdks/python/apache_beam/yaml/examples/transforms/ml/taxi_fare/streaming_taxifare_prediction.yaml:
##########
@@ -53,8 +53,13 @@ pipeline:
timestamp:
callable: |
from datetime import datetime, timezone
+ import re
+
+ _PAD_MICROS = re.compile(r'\.(\d{1,5})([+-]\d{2}:\d{2})$')
+
def fn(row):
- return
datetime.fromisoformat(row.timestamp).astimezone(timezone.utc)
+ ts = _PAD_MICROS.sub(lambda m: '.' + m.group(1).ljust(6, '0')
+ m.group(2), row.timestamp)
Review Comment:
Absolutely. that is a much better approach. Will change it on my other
branch, test, and push here when workflow is done.
--
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]