Skip to content

Conversation

@zhan7236
Copy link

Description

This PR removes the redundant minTopNThreshold field from TopNQueryConfig as requested in #16817.

The minTopNThreshold setting can already be overridden by the query context variable minTopNThreshold, making the config-based approach redundant. The default value (1000) is now available as a constant TopNQueryConfig.DEFAULT_MIN_TOPN_THRESHOLD.

Changes

Core Changes

  • Removed minTopNThreshold field and getMinTopNThreshold() method from TopNQueryConfig
  • Updated TopNQueryQueryToolChest.ThresholdAdjustingQueryRunner to use the default constant directly when query context doesn't specify the value

Test Framework Changes

  • Removed @MinTopNThreshold annotation from SqlTestFrameworkConfig
  • Updated SqlTestFramework to remove minTopNThreshold builder method
  • Updated tests in CalciteJoinQueryTest to use query context (QueryContexts.MIN_TOP_N_THRESHOLD) instead of the annotation
  • Updated QueryStackTests methods to deprecate the minTopNThreshold parameter (kept for backward compatibility)
  • Updated quidem test file to use !set minTopNThreshold 1 instead of URL parameter

Documentation Updates

  • Updated docs/configuration/index.md to mark druid.query.topN.minTopNThreshold as deprecated
  • Updated docs/querying/topnquery.md to remove the server parameter reference

Release Note

Deprecated: The server configuration druid.query.topN.minTopNThreshold is now deprecated. Use the minTopNThreshold query context parameter instead to control the TopN threshold per query.

This PR has:

  • been self-reviewed
  • added documentation for new or modified features or behaviors
  • a release note entry in the PR description (for user-impacting changes)
  • added Javadocs for most classes and all non-trivial methods
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for)}coverage is met
  • been tested in a test Druid cluster

Fixes #16817

This removes the minTopNThreshold config from TopNQueryConfig as it
can be overridden by the query context variable. The default value is
still available as a constant TopNQueryConfig.DEFAULT_MIN_TOPN_THRESHOLD.

Changes:
- Remove minTopNThreshold field and getter from TopNQueryConfig
- Update TopNQueryQueryToolChest to use the default constant directly
- Remove @MinTopNThreshold annotation from SqlTestFrameworkConfig
- Update tests to use query context for setting minTopNThreshold
- Deprecate minTopNThreshold parameter in QueryStackTests methods
- Update documentation to reflect the change

Fixes apache#16817
@Deprecated
public static QueryRunnerFactoryConglomerate createQueryRunnerFactoryConglomerate(
final Closer closer,
final Integer minTopNThreshold

Check notice

Code scanning / CodeQL

Useless parameter Note test

The parameter 'minTopNThreshold' is never used.
@Deprecated
public static QueryRunnerFactoryConglomerate createQueryRunnerFactoryConglomerate(
final DruidProcessingConfig processingConfig,
final Integer minTopNThreshold,

Check notice

Code scanning / CodeQL

Useless parameter Note test

The parameter 'minTopNThreshold' is never used.
- Update quidem test file CRC hash to match new test code
- Add @SuppressWarnings("unused") to deprecated methods in QueryStackTests.java
  to address security bot warnings about unused minTopNThreshold parameters
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.

Remove redundant TopNQueryConfig#minTopNThreshold

1 participant