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

fix missing required columns of CursorBuildSpec from RowFilterPolicy #17664

Conversation

clintropolis
Copy link
Member

@clintropolis clintropolis commented Jan 24, 2025

Description

changes:

  • RowFilterPolicy.visit and FilteredCursorFactory.makeCursorHolder now use new method CursorBuildSpecBuilder.andFilter to re-use the CursorBuildSpec transform of FilteredCursorFactory of adding a filter and its required columns to a CursorBuildSpec
  • Added javadoc to CursorFactory, CursorHolder, and CursorBuildSpec to clarify usage

This PR has:

  • been self-reviewed.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • been tested in a test Druid cluster.

changes:
* RowFilterPolicy.visit now uses new method FilteredCursorFactory.addFilter to re-use the CursorBuildSpec transform of FilteredCursorFactory of adding a filter and its required columns to a CursorBuildSpec
* Added javadoc to CursorFactory, CursorHolder, and CursorBuildSpec to clarify usage
Copy link
Contributor

@gianm gianm left a comment

Choose a reason for hiding this comment

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

The approach looks good to me but please add some more tests.

* {@link Filter#getRequiredColumns()} which are not present in {@link #virtualColumns} will be added to the
* existing set of {@link #physicalColumns}.
*/
public CursorBuildSpecBuilder andFilter(
Copy link
Contributor

Choose a reason for hiding this comment

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

please include tests for this method specifically, exercising cases like:

  • filter is null, filterToAdd is nonnull
  • filterToAdd is null, filterToAdd is null
  • both filters are nonnull
  • the filterToAdd references a column that the previous build spec doesn't reference

@clintropolis clintropolis merged commit 8344b9c into apache:master Jan 28, 2025
79 checks passed
@clintropolis clintropolis deleted the restricted-datasource-filter-policy-fix-spec-transform branch January 28, 2025 00:05
@cryptoe cryptoe added this to the 33.0.0 milestone Jan 28, 2025
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