-
Notifications
You must be signed in to change notification settings - Fork 18
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
BugFix :: JSON Flatten is unable to handle a list of json objects #47
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for redpanda-labs-preview ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
Thank you for your contribution. I think there is a (probably strange) edge case to handle, otherwise it looks great!
|
||
default: | ||
return isNodeFlattened |
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.
Why are we returning early here? Does this end up skipping over elements if there are heterogeneous lists? I.E.
[
"foo",
{"a":4},
5,
]
I think the above case will drop the 5 value.
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.
The above doesn't drop values, but it doesn't flatten the {"a": 4}
Object, either. If the first element ("foo"
) is removed, it will drop the 5
.
I'm conflicted on what the correct approach should be here. My original intent was to provide a close to drop in replacement for the Kafka Connect Flatten SMT. I believe the Flatten SMT supports heterogeneous Array flattening, but requires a schema. Maybe that's the correct approach here?
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.
Sorry, I didn't have much time to put in this PR lately. It has been a moment since I opened this PR, I don't remember why, to be honest. I will look it up as well when I will have a moment.
Hello!
It is me again!
I noticed the example couldn't handle lists of JSON objects as well. I fixed it, and I made quite a mess last time I contributed, so I cleaned behind myself 😉 .
As you will be able to see in my example below, I went for a common way to annotate the element that is part of a list by identifying it with the index of the element of the list.
Example:
Before:
After:
Thank you 😄