Skip to content

[INLONG-8173][Sort] Fix the NPE problem when adding new columns - #8174

Merged
dockerzhang merged 2 commits into
apache:masterfrom
lordcheng10:fix_ddl
Jun 7, 2023
Merged

[INLONG-8173][Sort] Fix the NPE problem when adding new columns#8174
dockerzhang merged 2 commits into
apache:masterfrom
lordcheng10:fix_ddl

Conversation

@lordcheng10

@lordcheng10 lordcheng10 commented Jun 7, 2023

Copy link
Copy Markdown
Contributor

Prepare a Pull Request

(Change the title refer to the following example)

  • Title Example: [INLONG-XYZ][Component] Title of the pull request

(The following XYZ should be replaced by the actual GitHub Issue number)

Motivation

When Column#position may be null, the doAddColumn method may throw NPE:

column.getPosition().getPositionType() == PositionType.FIRST ? TableChange.ColumnPosition.first()
: TableChange.ColumnPosition.after(column.getName());
TableChange.AddColumn addColumn = new TableChange.AddColumn(new String[]{column.getName()},

Modifications

When Column#position is null, append to the last column by default.

Verifying this change

(Please pick either of the following options)

  • This change is a trivial rework/code cleanup without any test coverage.

  • This change is already covered by existing tests, such as:
    (please describe tests)

  • This change added tests and can be verified as follows:

    (example:)

    • Added integration tests for end-to-end deployment with large payloads (10MB)
    • Extended integration test for recovery after broker failure

Documentation

  • Does this pull request introduce a new feature? (yes / no)
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
  • If a feature is not applicable for documentation, explain why?
  • If a feature is not documented yet in this PR, please create a follow-up issue for adding the documentation

@lordcheng10

Copy link
Copy Markdown
Contributor Author

@gong @EMsnap @yunqingmoswu PTAL,thanks!

@dockerzhang
dockerzhang merged commit 1a9fbc9 into apache:master Jun 7, 2023
@lordcheng10
lordcheng10 deleted the fix_ddl branch June 16, 2023 03:50
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.

[Bug][Sort] Fix the NPE problem when adding new columns

4 participants