imankhadiv opened a new pull request, #29027:
URL: https://github.com/apache/flink/pull/29027
## What is the purpose of the change
`OutputConversionOperator.processElement` dereferences the result of
`RowData#getTimestamp(...)` without a null check, so converting a table with a
`null` rowtime attribute into a `DataStream` fails the job with a
`NullPointerException`. Both rowtime paths are affected: the rowtime metadata
path and the rowtime column path.
Adding null checks alone is not enough. `outRecord` is a single
`StreamRecord` allocated once in `open()` and reused for every element, and
`StreamRecord#replace(Object)` leaves the timestamp untouched. Merely skipping
`setTimestamp()` would leave the *previous* record's timestamp on the record
carrying the null rowtime, i.e. it would trade the `NullPointerException` for a
silently wrong timestamp. The null case therefore erases the timestamp
explicitly.
## Brief change log
- Both rowtime lookups in `OutputConversionOperator` go through a new
private `updateRowtime(RowData, int)` helper
- The helper sets the output timestamp when the rowtime is present, and
calls `StreamRecord#eraseTimestamp()` when it is null, so a record with a null
rowtime cannot inherit the preceding record's timestamp
## Verifying this change
This change added tests and can be verified as follows:
- Added `OutputConversionOperatorTest` with four cases — a null rowtime is
emitted without a timestamp, and a null rowtime does not inherit the timestamp
of the preceding record — each covering the rowtime metadata path and the
rowtime column path
- All four tests were watched failing before the fix: first with the
reported `NullPointerException`, and the two "does not inherit" cases again
against a null-check-only variant of the fix, which is what motivated the
explicit `eraseTimestamp()`
- `flink-table-runtime` module test suite passes (1824 tests)
- `DataStreamJavaITCase` passes (38 tests); it covers the non-null rowtime
path end to end via `toDataStream` with event-time windows and a downstream
assertion on `ctx.timestamp()`
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): **no**
- The public API, i.e., is any changed class annotated with
`@Public(Evolving)`: **no**
- The serializers: **no**
- The runtime per-record code paths (performance sensitive): **yes** — one
additional `isNullAt` check per record, in an operator that already read the
rowtime field
- Anything that affects deployment or recovery: JobManager (and its
components), Checkpointing, Kubernetes/Yarn, ZooKeeper: **no**
- The S3 file system connector: **no**
## Documentation
- Does this pull request introduce a new feature? **no**
- If yes, how is the feature documented? **not applicable**
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes (please specify the tool below)
Generated-by: Claude Code (Claude Opus 5)
--
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]