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

[MongoDB] Fix NullPointerException when executing ddl operation in MongoDB #2107

Merged
merged 4 commits into from
Jun 12, 2023

Conversation

e-mhui
Copy link
Contributor

@e-mhui e-mhui commented May 1, 2023

[MongoDB] Fix NullPointerException when executing ddl operation in MongoDB

Fix: #2106

When performing DDL operations in MongoDB, documentKey and fullDocument are null, so we need to check if it is a DML operation and retrieve documentKey and fullDocument from the record.

    if (isDMLOperation(op)) {
        documentKey =
                checkNotNull(
                        extractBsonDocument(
                                value, valueSchema, MongoDBEnvelope.DOCUMENT_KEY_FIELD));
        fullDocument =
                extractBsonDocument(value, valueSchema, MongoDBEnvelope.FULL_DOCUMENT_FIELD);
    }

@Jiabao-Sun Jiabao-Sun self-requested a review May 18, 2023 12:56
Copy link
Contributor

@Jiabao-Sun Jiabao-Sun left a comment

Choose a reason for hiding this comment

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

Thanks @e-mhui for report this problem.
I think delaying the empty check can also solve this problem.

@Jiabao-Sun Jiabao-Sun merged commit 7cdeb0d into apache:master Jun 12, 2023
2 of 13 checks passed
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.

[Bug] NullPointerException when executing a rename collection operation in MongoDB
2 participants