Skip to content

Fix dictionarySize overrides in tests#15354

Merged
cryptoe merged 11 commits into
apache:masterfrom
kgyrtkirk:size-check-annot
Nov 28, 2023
Merged

Fix dictionarySize overrides in tests#15354
cryptoe merged 11 commits into
apache:masterfrom
kgyrtkirk:size-check-annot

Conversation

@kgyrtkirk

@kgyrtkirk kgyrtkirk commented Nov 9, 2023

Copy link
Copy Markdown
Member

I think this is a problem as it discards the false return value when the putToKeyBuffer can't store the value because of the limit

Not forwarding the return value at that point may lead to the normal continuation here regardless something was not added to the dictionary like here

This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • a release note entry in the PR description.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.

@kgyrtkirk

Copy link
Copy Markdown
Member Author

the way the code disallowed override made it also loose the custom settings used in
GroupByQueryRunnerTest

@LakshSingla LakshSingla left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there an easy way to test out the NullableRowBasedKeySerdeHelper using a query, where the delegate returns false, but, the helper returns true which causes the query to fail with an unexpected message
Would setting a small value of maxDictionarySize trigger this test case? The patch is gtg as it is since the change is pretty straightforward anyway.

Comment on lines +51 to +52
private static final String CTX_KEY_MAX_SELECTOR_DICTIONARY_SIZE = "maxSelectorDictionarySize";
private static final String CTX_KEY_MAX_MERGING_DICTIONARY_SIZE = "maxMergingDictionarySize";

@LakshSingla LakshSingla Nov 22, 2023

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should mention that this is configurable per query in the Druid's docs as well.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I've added it to the docs here

any other places I should add it?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Kinda weird that docs/configuration/index.md says that we can override, even though overriding was a no-op.

Looking up the blame, it is mentioned here #12763, that removing it was intentional. Perhaps we should not add it back then, and fix up the discrepancy above WDYT?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It was removed from the context as setting it might not be a common case + "complicates calculation"
...however as the tests also rely on similar ways...I went to add it back
I believe its better to have all options follow the same convention... instead of doing something different just for these options...(which have silently caused that this feature become untested)

fyi: @gianm

@LakshSingla LakshSingla Nov 24, 2023

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you also modify the documentation for both the parameters here

|`maxSelectorDictionarySize`|Can be used to lower the value of `druid.query.groupBy.maxMergingDictionarySize` for this query.|
as the part of the fix here to mention that it is not just lower, but override. Someone can intentionally or accidentally set it to a higher value.

@kgyrtkirk kgyrtkirk changed the title Return value of putToKeyBuffer is discarded Fix dictionarySize overrides in tests Nov 24, 2023
@kgyrtkirk

Copy link
Copy Markdown
Member Author

actually; in all cases around that point in putToKeyBuffer the delegate is always an instance which never returns false; which makes that part of this PR a theoretical fix.

@LakshSingla

Copy link
Copy Markdown
Contributor

Thanks for the contribution!

@cryptoe
cryptoe merged commit eb056e2 into apache:master Nov 28, 2023
yashdeep97 pushed a commit to yashdeep97/druid that referenced this pull request Dec 1, 2023
I think this is a problem as it discards the false return value when the putToKeyBuffer can't store the value because of the limit

Not forwarding the return value at that point may lead to the normal continuation here regardless something was not added to the dictionary like here
yashdeep97 pushed a commit to yashdeep97/druid that referenced this pull request Dec 1, 2023
I think this is a problem as it discards the false return value when the putToKeyBuffer can't store the value because of the limit

Not forwarding the return value at that point may lead to the normal continuation here regardless something was not added to the dictionary like here
@LakshSingla LakshSingla added this to the 29.0.0 milestone Jan 29, 2024
riovic918data pushed a commit to riovic918data/druid that referenced this pull request Jun 12, 2026
I think this is a problem as it discards the false return value when the putToKeyBuffer can't store the value because of the limit

Not forwarding the return value at that point may lead to the normal continuation here regardless something was not added to the dictionary like here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants