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

Avoid dynamic filter current predicate computation when not used #9867

Conversation

findepi
Copy link
Member

@findepi findepi commented Nov 4, 2021

DynamicFilter.getCurrentPredicate is not free to call. Do not call it
when results wouldn't be used.

The edge case, where getCurrentPredicate() returns
TupleDomain.none() is not worth optimizing for. In the future, it can
be handled by the engine instead.

cc @losipiuk @alexjo2144

BooleanSupplier partitionMatchSupplier = () -> partitionMatches(partitionColumns, dynamicFilter.getCurrentPredicate(), hivePartition);
BooleanSupplier partitionMatchSupplier =
partitionColumns.stream().anyMatch(dynamicFilter.getColumnsCovered()::contains)
? () -> true
Copy link
Member

Choose a reason for hiding this comment

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

I think this should the the other way around: if there is covering column then use partitionMatches(partitionColumns, dynamicFilter.getCurrentPredicate(), hivePartition)

Copy link
Member Author

Choose a reason for hiding this comment

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

of course, you're correct.
this indicates some missing test coverage, since i just nuked a feature, and build is still green.
@raunaqmorarka @sopel39 do you have idea how this could be tested? can you test cover that?

Copy link
Member

@sopel39 sopel39 Nov 5, 2021

Choose a reason for hiding this comment

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

There is TestHiveDynamicPartitionPruningTest but I guess it's not complete due to #5172

`DynamicFilter.getCurrentPredicate` is not free to call. Do not call it
when results wouldn't be used.

The edge case, where `getCurrentPredicate()` returns
`TupleDomain.none()` is not worth optimizing for. In the future, it can
be handled by the engine instead.
@findepi findepi force-pushed the findepi/avoid-dynamic-filter-current-predicate-computation-when-not-used-fbb3ac branch from b6ff62d to a6a9056 Compare November 5, 2021 16:21
@findepi findepi requested a review from sopel39 November 5, 2021 16:21
Copy link
Member

@sopel39 sopel39 left a comment

Choose a reason for hiding this comment

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

lgtm % but I would wait until DF part pruning tests are restored (which I plan todo)

@sopel39
Copy link
Member

sopel39 commented Nov 25, 2021

@findepi dynamic partition pruning tests land. Do you want to rebase & merge?

@findepi findepi merged commit ef5084c into trinodb:master Nov 25, 2021
@findepi findepi deleted the findepi/avoid-dynamic-filter-current-predicate-computation-when-not-used-fbb3ac branch November 25, 2021 19:45
@github-actions github-actions bot added this to the 365 milestone Nov 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants