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

feat(detectedFields): Support multiple parsers to be returned for a single field #12899

Merged
merged 5 commits into from
May 7, 2024

Conversation

svennergr
Copy link
Contributor

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 a parsers: []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.

@svennergr svennergr requested a review from a team as a code owner May 6, 2024 13:30
Copy link
Collaborator

@trevorwhitney trevorwhitney left a 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 {
Copy link
Collaborator

@trevorwhitney trevorwhitney May 6, 2024

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree, added a comment!

@cyriltovena cyriltovena merged commit 19fef93 into main May 7, 2024
58 checks passed
@cyriltovena cyriltovena deleted the svennergr/detected_fields_type_check branch May 7, 2024 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants