Skip to content

Conversation

dawidwys
Copy link
Contributor

@dawidwys dawidwys commented Oct 3, 2023

What is the purpose of the change

The change prohibits serialising ExecNode with a wrong type. Previously it was possible to create a null_null type.
Moreover it gives a better exception when deserialising such a node.

Brief change log

  • added checks in ExecNodeContext

Verifying this change

Added a test for deserialising an ExecNode with null_null type.
Added a test for serialisation in org.apache.flink.table.planner.plan.nodes.exec.serde.ExecNodeGraphJsonSerializerTest

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (yes / no)
  • The public API, i.e., is any changed class annotated with @Public(Evolving): (yes / no)
  • The serializers: (yes / no / don't know)
  • The runtime per-record code paths (performance sensitive): (yes / no / don't know)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (yes / no / don't know)
  • The S3 file system connector: (yes / no / don't know)

Documentation

  • Does this pull request introduce a new feature? (yes / no)
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)

@flinkbot
Copy link
Collaborator

flinkbot commented Oct 3, 2023

CI report:

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

Copy link
Contributor

@twalthr twalthr left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @dawidwys. I left some comments.

Copy link
Contributor

@twalthr twalthr left a comment

Choose a reason for hiding this comment

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

LGTM

public ExecNodeContext(String value) {
this.id = null;
String[] split = value.split("_");
if ("null".equals(split[0]) || "null".equals(split[1])) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not very familiar with this code; you are saying that the value can come through as either null_xxx or yyy_null.
Is there not a way to test for these nulls prior to calling this.

Also I wonder if you should check for the failure of Integer.valueOf(split[1]); and give a nicer message in that case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please see the discussion here: #23488 (comment)

PlanReference.fromResource(
"/jsonplan/testInvalidTypeJsonPlan.json")))
.hasRootCauseMessage(
"Unsupported exec node type: 'null_null'.");
Copy link
Contributor

Choose a reason for hiding this comment

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

can we test xxx_null as well, so we test the || "null".equals(split[1]) part of the if

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is not really possible to achieve this. Please see the discussion: #23488 (comment)

throw new TableException(
String.format(
"Can not serialize ExecNode with id: %d. Missing type, this is a bug,"
+ " please file a ticket.",
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest rephrasing to raising a Jira and including the url.

Copy link
Contributor Author

@dawidwys dawidwys Oct 9, 2023

Choose a reason for hiding this comment

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

The current phrasing is in line with other similar places. I would also not use a proprietary system name in the code. It's not guaranteed Apache and Flink in particular continues using JIRA.

FlinkVersion.v1_18,
Collections.singletonList(new NoAnnotationNode()))))
.hasMessageContaining(
"Can not serialize ExecNode with id: 10. Missing type, this is a bug, please file a ticket");
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest rephrasing to raising a Jira and including the url.

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.

4 participants