jk-shah opened a new issue, #41349:
URL: https://github.com/apache/beam/issues/41349
### What happened?
In Beam YAML, `AssignTimestamps`
(`sdks/python/apache_beam/yaml/yaml_mapping.py`, lines `852-875`) wraps the
evaluated `timestamp` expression directly in `TimestampedValue(x,
timestamp_fn(x))`:
```python
timestamp_fn = _as_callable_for_pcoll(pcoll, timestamp, 'timestamp',
language)
T = TypeVar('T')
return pcoll | beam.Map(lambda x: TimestampedValue(x, timestamp_fn(x))
).with_input_types(T).with_output_types(T)
```
Because `TimestampedValue` calls `Timestamp.of(...)`
(`apache_beam/utils/timestamp.py:166`), which only accepts `int`, `float`, or
`Timestamp`, passing an ISO-8601 / RFC-3339 string column (e.g.
`"2026-01-01T00:00:10Z"`, the default representation produced by `ReadFromCsv`
and `ReadFromJson`) or a `datetime.datetime` object fails at runtime with:
```
TypeError: Cannot interpret '2026-01-01T00:00:10Z' <class 'str'> as a
Timestamp.
```
Minimal YAML reproducer:
```yaml
pipeline:
transforms:
- type: Create
config:
elements:
- {id: 1, event_time: "2026-01-01T00:00:10Z"}
- type: AssignTimestamps
config:
timestamp: event_time
input: Create
```
### Cause
`yaml_mapping._AssignTimestamps` does not convert RFC-3339 / ISO-8601 `str`
values (`Timestamp.from_rfc3339` / `datetime.fromisoformat`) or
`datetime.datetime` objects (`dt.timestamp()`) before constructing
`TimestampedValue`.
### Issue Priority
Priority: 2 (default / most bugs should be filed as P2)
### Issue Components
- [x] Component: Python SDK
- [ ] Component: Java SDK
- [ ] Component: Go SDK
- [ ] Component: Typescript SDK
- [ ] Component: IO connector
- [x] Component: Beam YAML
- [ ] Component: Beam ML
- [ ] Component: Beam examples
- [ ] Component: Beam playground
- [ ] Component: Beam katas
- [ ] Component: Website
- [ ] Component: Infrastructure
- [ ] Component: Spark Runner
- [ ] Component: Flink Runner
- [ ] Component: Prism Runner
- [ ] Component: Hazelcast Jet Runner
- [ ] Component: Google Cloud Dataflow Runner
--
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]