Skip to content

[FLINK-40015] Introduce getRuntimeOutput in PTF Test Harness#28657

Open
autophagy wants to merge 1 commit into
apache:masterfrom
autophagy:FLINK-40015
Open

[FLINK-40015] Introduce getRuntimeOutput in PTF Test Harness#28657
autophagy wants to merge 1 commit into
apache:masterfrom
autophagy:FLINK-40015

Conversation

@autophagy

@autophagy autophagy commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

What is the purpose of the change

When testing the PTF Test Harness against the ProcessTableFunctionTestPrograms, I found a bug that occurs when trying to use a PTF that emits a non-row type in a mode where the harness adds extra columns (rowtime with on_time, partition columns, etc). This exposed a bit of a behaviour gap which this PR hopes to fill.

This PR redfines getOutput so that it returns only the emitted output from the PTF itself, either the Pojo, atomic type, Row (without extra columns), etc. It also introduces a getRuntimeOutput which always returns a Row and is more like what the runtime would actually emit. The reason for this was that a user is more likely to want to test the actual produced output of their PTF in particular, than what the runtime also emits. There could be cases where the user would like to test this, to see what partition keys are emitted for example, so getRuntimeOutput would aim to cover this case.

I also fixed a bug that surfaced when implementing this, where it was resetting the row kind of Rows to INSERT when appending the rowtime column.

Brief change log

  • Changed getOutput in ProcessTableFunctionTestHarness to only return the emitted object from the PTF based on the PTF's declared return type, without extra columns.
  • Added getRuntimeOutput in ProcessTableFunctionTestHarness to provide users a way to examine what the runtime might actually emit, with passthrough columns, partition columns, rowtime, etc.

Verifying this change

This change added tests and can be verified by running ProcessTableFunctionTestHarnessTest.

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): (no)
  • 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? (yes)
  • If yes, how is the feature documented? (docs / JavaDocs)

Was generative AI tooling used to co-author this PR?
  • Yes (2.1.201 (Claude Code)

Comment thread docs/content/docs/dev/table/functions/ptfs.md Outdated
@flinkbot

flinkbot commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

@autophagy autophagy changed the title [FLINK-40015] Introduce getSystemOutput in PTF Test Harness [FLINK-40015] Introduce getRuntimeOutput in PTF Test Harness Jul 7, 2026
harness.processElement(Row.of("B", 20));

List<Row> output = harness.getOutput();
List<Row> output = harness.getRuntimeOutput();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about we call this getFullOutput()?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants