-
Notifications
You must be signed in to change notification settings - Fork 255
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
Conversation
There was a problem hiding this 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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 = |
There was a problem hiding this comment.
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 = |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👏
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']