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

[Pulsar SQL] Handle message null schema version in PulsarRecordCursor #12809

Merged

Conversation

gaoran10
Copy link
Contributor

Motivation

Currently, if the schema version of the message is null, the Pulsar SQL will encounter an NPE problem.

Modifications

Adjust logic for null schema version in PulsarRecordCursor.

  1. If the schema type of pulsarSplit is NONE or BYTES, use the BYTES schema.
  2. If the schema type of pulsarSplit is BYTEBUFFER, use the BYTEBUFFER schema.
  3. If the schema version of the message is null, use the latest schema of the topic.
  4. If the schema version of the message is not null, get the specific version schema by PulsarAdmin.
  5. If the final schema is null throw a runtime exception.

Verifying this change

Add a new test for the method getSchemaInfo to verify get the correct schema info.

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

If yes was chosen, please highlight the changes

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API: (no)
  • The schema: (no)
  • The default values of configurations: (no)
  • The wire protocol: (no)
  • The rest endpoints: (no)
  • The admin cli options: (no)
  • Anything that affects deployment: (no)

Documentation

Check the box below and label this PR (if you have committer privilege).

Need to update docs?

  • doc-required

    (If you need help on updating docs, create a doc issue)

  • no-need-doc

    (Please explain why)

  • doc

    (If this PR contains doc changes)

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Nov 15, 2021
@gaoran10 gaoran10 added the area/sql Pulsar SQL related features label Nov 15, 2021
Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

+1

@congbobo184 congbobo184 merged commit e5619cf into apache:master Nov 16, 2021
@gaoran10 gaoran10 deleted the gaoran/sql-handle-null-schema-version branch November 16, 2021 08:22
codelipenghui pushed a commit that referenced this pull request Nov 18, 2021
…#12809)

### Motivation

Currently, if the schema version of the message is null, the Pulsar SQL will encounter an NPE problem.

### Modifications

Adjust logic for null schema version in `PulsarRecordCursor`.

1. If the schema type of pulsarSplit is NONE or BYTES, use the BYTES schema.
2. If the schema type of pulsarSplit is BYTEBUFFER, use the BYTEBUFFER schema.
3. If the schema version of the message is null, use the latest schema of the topic.
4. If the schema version of the message is not null, get the specific version schema by PulsarAdmin.
5. If the final schema is null throw a runtime exception.

(cherry picked from commit e5619cf)
@codelipenghui codelipenghui added cherry-picked/branch-2.8 Archived: 2.8 is end of life release/2.8.2 and removed release/2.8.3 labels Nov 18, 2021
eolivelli pushed a commit to eolivelli/pulsar that referenced this pull request Nov 29, 2021
…apache#12809)

### Motivation

Currently, if the schema version of the message is null, the Pulsar SQL will encounter an NPE problem.

### Modifications

Adjust logic for null schema version in `PulsarRecordCursor`.

1. If the schema type of pulsarSplit is NONE or BYTES, use the BYTES schema.
2. If the schema type of pulsarSplit is BYTEBUFFER, use the BYTEBUFFER schema.
3. If the schema version of the message is null, use the latest schema of the topic.
4. If the schema version of the message is not null, get the specific version schema by PulsarAdmin.
5. If the final schema is null throw a runtime exception.
fxbing pushed a commit to fxbing/pulsar that referenced this pull request Dec 19, 2021
…apache#12809)

### Motivation

Currently, if the schema version of the message is null, the Pulsar SQL will encounter an NPE problem.

### Modifications

Adjust logic for null schema version in `PulsarRecordCursor`.

1. If the schema type of pulsarSplit is NONE or BYTES, use the BYTES schema.
2. If the schema type of pulsarSplit is BYTEBUFFER, use the BYTEBUFFER schema.
3. If the schema version of the message is null, use the latest schema of the topic.
4. If the schema version of the message is not null, get the specific version schema by PulsarAdmin.
5. If the final schema is null throw a runtime exception.
codelipenghui pushed a commit that referenced this pull request Dec 21, 2021
…#12809)

### Motivation

Currently, if the schema version of the message is null, the Pulsar SQL will encounter an NPE problem.

### Modifications

Adjust logic for null schema version in `PulsarRecordCursor`.

1. If the schema type of pulsarSplit is NONE or BYTES, use the BYTES schema.
2. If the schema type of pulsarSplit is BYTEBUFFER, use the BYTEBUFFER schema.
3. If the schema version of the message is null, use the latest schema of the topic.
4. If the schema version of the message is not null, get the specific version schema by PulsarAdmin.
5. If the final schema is null throw a runtime exception.

(cherry picked from commit e5619cf)
@codelipenghui codelipenghui added the cherry-picked/branch-2.9 Archived: 2.9 is end of life label Dec 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/sql Pulsar SQL related features cherry-picked/branch-2.8 Archived: 2.8 is end of life cherry-picked/branch-2.9 Archived: 2.9 is end of life doc-not-needed Your PR changes do not impact docs release/2.8.2 release/2.9.2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants