Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FLINK-23537][table-common] Make JoinedRowData public #16631

Merged
merged 1 commit into from
Jul 30, 2021

Conversation

Airblader
Copy link
Contributor

@Airblader Airblader commented Jul 29, 2021

What is the purpose of the change

This exposes JoinedRowData as public API. When implementing Table API connectors, the need to join RowData arises naturally from having to append metadata to the produced physical row. We should therefore make it easy for implementors to do so without relying on internal APIs.

This PR makes the class public, updates its documentation and adds some basic tests for it.

Verifying this change

This change is already covered by existing tests. However, JoinedRowDataTest has also been added.

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): yes
  • The serializers: no
  • The runtime per-record code paths (performance sensitive): "yes", but no actual runtime behavior has been changed
  • 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? JavaDocs

*
* <p>This implementation is mutable to allow for performant changes in hot code paths.
*/
@PublicEvolving
public class JoinedRowData implements RowData {

private RowKind rowKind = RowKind.INSERT;
private RowData row1;
Copy link
Contributor Author

@Airblader Airblader Jul 29, 2021

Choose a reason for hiding this comment

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

(I didn't add @Nullable to the fields since this produces a lot of warnings in the class, and making the IDE happy by checking non-nullability first imposes a runtime cost. I decided to instead document this explicitly.)

@flinkbot
Copy link
Collaborator

flinkbot commented Jul 29, 2021

Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
to review your pull request. We will use this comment to track the progress of the review.

Automated Checks

Last check on commit 4829e0b (Thu Sep 23 18:53:04 UTC 2021)

Warnings:

  • No documentation files were touched! Remember to keep the Flink docs up to date!

Mention the bot in a comment to re-run the automated checks.

Review Progress

  • ❓ 1. The [description] looks good.
  • ❓ 2. There is [consensus] that the contribution should go into to Flink.
  • ❓ 3. Needs [attention] from.
  • ❓ 4. The change fits into the overall [architecture].
  • ❓ 5. Overall code [quality] is good.

Please see the Pull Request Review Guide for a full explanation of the review process.


The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required Bot commands
The @flinkbot bot supports the following commands:

  • @flinkbot approve description to approve one or more aspects (aspects: description, consensus, architecture and quality)
  • @flinkbot approve all to approve all aspects
  • @flinkbot approve-until architecture to approve everything until architecture
  • @flinkbot attention @username1 [@username2 ..] to require somebody's attention
  • @flinkbot disapprove architecture to remove an approval you gave earlier

@@ -27,7 +27,7 @@
import org.apache.flink.table.data.RowData;
import org.apache.flink.table.data.StringData;
import org.apache.flink.table.data.TimestampData;
import org.apache.flink.table.data.utils.JoinedRowData;
import org.apache.flink.table.data.JoinedRowData;
Copy link
Member

Choose a reason for hiding this comment

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

Personally, I don't suggest to move package.

  1. I believe there are some external connectors are aready using it and this will break them.
  2. It was moved from org.apache.flink.table.data to org.apache.flink.table.data.utils in [FLINK-18858][connector-kinesis] Add Kinesis sources and sinks #13770 (comment).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks Jark, that's a good point. I'll just remove the second commit.

@flinkbot
Copy link
Collaborator

flinkbot commented Jul 29, 2021

CI report:

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

assertEquals(1L, joinedRow.getLong(0));
assertEquals(2L, joinedRow.getLong(1));
assertEquals(3L, joinedRow.getLong(2));
assertEquals("4", joinedRow.getString(3).toString());
Copy link
Contributor

Choose a reason for hiding this comment

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

Extend this test case to also test the replace method. It's probably the most important method in this class.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair point! I've added a test case for it.

Copy link
Contributor

@tsreaper tsreaper left a comment

Choose a reason for hiding this comment

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

Looks good to me. Let's see if Jark has some other thoughts.

Copy link
Member

@wuchong wuchong left a comment

Choose a reason for hiding this comment

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

LGTM.

@wuchong wuchong merged commit a53964b into apache:master Jul 30, 2021
@Airblader Airblader deleted the FLINK-23537 branch August 2, 2021 09:11
hhkkxxx133 pushed a commit to hhkkxxx133/flink that referenced this pull request Aug 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants