-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
feat(detectedFields): Support multiple parsers to be returned for a single field #12899
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.
lgtm! one comment to call all the assumption were making about field types in single streams vs. when merging the results. wonder if it's worth a comment in the code?
for _, v := range vals { | ||
parsedFields := detectedFields[k] | ||
if !parsedFields.isTypeDetected { | ||
if detectType { |
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.
this is tricky. just to be clear, the assumption here is that fields in the same stream will have the same type, but fields in different streams may have different types which is why we only include the default "string" type logic in the merge code?
I think that's probably a safe assumption, and it save us from having to run the determine type logic on every line, but I want to make sure it's clear to future readers the assumption we're making.
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.
Agree, added a comment!
What this PR does / why we need it:
Detected fields across different streams can require different parsers, thus this PR changes the
parser
property to aparsers: []string
property.Furthermore, if multiple fields with the same label/name are detected but different types, we set that to
string
now.Special notes for your reviewer:
I removed the
parsedFields.isTypeDetected
property and will just detect the type for each new stream, as this is most likely to differ there. Let me know if you think that should change.