Skip to content

Conversation

@fiinnnn
Copy link
Contributor

@fiinnnn fiinnnn commented Aug 5, 2025

Hey, first-time contributor here.

I noticed log fields weren't being flattened consistently and kept randomly changing on every refresh.

After looking into it, I noticed the flatten function isn't tracking depth correctly: currentDepth is incremented before every recursive call but never decremented.
As a result, after 10 steps, any further fields don't get flattened, and since map iteration order is random, the result differs per log line and per request.

This fixes the issue by decrementing currentDepth after returning from the recursive call.
Alternatively, it might be worth considering if the depth limit is really needed here.
The function is only ever used to flatten JSON objects, so an infinite loop would be extremely unlikely/impossible.

Fixes #137

Copy link
Contributor

@fmassot fmassot left a comment

Choose a reason for hiding this comment

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

Looks good. I will add another test which reproduces the issue. Thanks @fiinnnn

@fmassot fmassot merged commit b3ee986 into quickwit-oss:main Aug 9, 2025
1 of 2 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.

rendering fields has a funky behaivor for object fields in Explore

2 participants