Abacn commented on code in PR #35766: URL: https://github.com/apache/beam/pull/35766#discussion_r2248602497
########## 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: I see, it's because microseconds < 6 digit wasn't valid for Python 3.10, 3.10 but valid for Python 3.11, 3.12. Probably some upstream dependency change caused the timestamp string format change. I would suggest either to skip this test for Python<=3.10, or change the fn(row) to only replace in Python<=3.10, for a clearer example -- 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: github-unsubscr...@beam.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org