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

KAFKA-388: Add NullFieldValueRemover post processor #170

Merged
merged 5 commits into from
Nov 20, 2024

Conversation

Calvinnix
Copy link
Collaborator

@Calvinnix Calvinnix commented Nov 15, 2024

This adds a new post processor to support removing fields that have null values.

e.g.
{ foo: { a: null, b: 1, c: null } } is transformed into { foo: { b: 1 } }
{ foo: { 'myNull1': null, 'myNull2': null, 'myNull3': null } } is transformed into { foo: {} }
{ 'myArray': ['a', {'myArrayValueDocumentNull1': null}] } is transformed into { 'myArray': ['a', {}] }

note that null elements in arrays will be kept
'myArray': [null, 'a'] is not impacted 'myArray': [null, 'a']

@Calvinnix Calvinnix requested a review from arahmanan November 18, 2024 21:02
Copy link
Collaborator

@arahmanan arahmanan left a comment

Choose a reason for hiding this comment

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

Great work! Just some super minor comments from my end

@@ -5,7 +5,7 @@
## 1.13.1

### Bug Fixes
- [KAFKA-428](https://jira.mongodb.org/browse/KAFKA-428) Avoid unnecessary copy of data on restart
- [KAFKA-428](https://jira.mongodb.org/browse/KAFKA-428) Avoid unnecessary copy of data on restart
Copy link
Collaborator

Choose a reason for hiding this comment

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

[opt/q] was this intentional?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah my IDE kept fixing this automatically so I thought I'd just go ahead and commit this fix.


assertEquals(Optional.of(expected), sinkDocWithValueDoc.getValueDoc());

elements =
Copy link
Collaborator

Choose a reason for hiding this comment

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

[opt] Thoughts on breaking this into multiple test functions for clarity?

@Test
@DisplayName("test NullFieldValueRemoverTest nested document")
void testNullFieldValueRemoverNestedDocument() {
List<BsonElement> elements =
Copy link
Collaborator

Choose a reason for hiding this comment

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

[q] I find this format a little hard to read. Would something similar to this test work?

@Calvinnix Calvinnix requested a review from arahmanan November 19, 2024 14:27
Copy link
Collaborator

@arahmanan arahmanan left a comment

Choose a reason for hiding this comment

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

LGTM! 👏

@Calvinnix Calvinnix merged commit 74f141a into mongodb:master Nov 20, 2024
16 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.

2 participants