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 filter pushdown for DELETE queries #13705

Merged
merged 1 commit into from
Nov 16, 2019

Conversation

mbasmanova
Copy link
Contributor

== NO RELEASE NOTE ==

@mbasmanova mbasmanova added the aria Presto Aria performance improvements label Nov 14, 2019
@mbasmanova mbasmanova requested review from wenleix, highker and a team November 14, 2019 22:56
Copy link
Contributor

@bhhari bhhari left a comment

Choose a reason for hiding this comment

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

LGTM

@bhhari
Copy link
Contributor

bhhari commented Nov 15, 2019

@mbasmanova i guess you need to rebase, unrelated build issue

{
return true;
if (!tableLayoutHandle.isPresent()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need a requireNonNull check for the arguments here or are they handled in the caller?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From what I've seen in Presto codebase, requireNonNull is used only in constructors.

Copy link
Contributor

Choose a reason for hiding this comment

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

sure, the question was more geared towards do we need to null check using either requireNonNull or explicit arg==null .

@@ -1677,6 +1677,15 @@ public void testMetadataDelete()

assertQuery("SELECT * from test_metadata_delete", "SELECT orderkey, linenumber, linestatus FROM lineitem WHERE linestatus<>'F' or linenumber<>3");

// TODO This use case can be supported
Copy link
Contributor

Choose a reason for hiding this comment

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

can you please explain what this //TODO means.
Is this a failing test that needs to be fixed later on or some functionality that needs to be added.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ajaygeorge This is missing functionality. This query should work fine, but it doesn't. Since this is existing behavior, I'm keeping it like that for pushdown-query code path.

@ajaygeorge
Copy link
Contributor

As a side note, I have always wondered what is the reasoning behind presto's choice behind accepting Optionals as arguments. As referenced in this sonar code quality check rule Optionals as arguments was probably not intended by the authors.

The Java language authors have been quite frank that Optional was intended for use only as a return type, as a way to convey that a method may or may not return a value.

And for that, it's valuable but using Optional on the input side increases the work you have to do in the method without really increasing the value. 

With an Optional parameter, you go from having 2 possible inputs: null and not-null, to three: null, non-null-without-value, and non-null-with-value. Add to that the fact that overloading has long been available to convey that some parameters are optional, and there's really no reason to have Optional parameters.

@mbasmanova
Copy link
Contributor Author

@ajaygeorge

As a side note,

I don't have an answer to that.

@ajaygeorge
Copy link
Contributor

@ajaygeorge

As a side note,

I don't have an answer to that.

Do we even need an Optional argument here.? 🤔
The usage of the Optional in this context is basically checking for isPresent and then take an action which is very similar to a null check and then proceeding.

If it has been the standard that we have been following then it makes sense to keep it as is.

LGTM as well !

@mbasmanova
Copy link
Contributor Author

@ajaygeorge

If it has been the standard that we have been following then it makes sense to keep it as is.

Yes, this is how it is currently done in the codebase.

Copy link
Contributor

@highker highker left a comment

Choose a reason for hiding this comment

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

one minor comment

{
return true;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we have an enumeration of comments to explain the cases when metadata delete can happen and when it can't? By looking at the code, it seems that it's not an all or nothing call given the filter could be "simple" or very "complicated" but turning to be simple if we do constant folding or even evaluation. Of course, there is a limit we can push. We can only inference the delete if the filter is not "that complicated" .

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@highker James, thank you review.

Strictly speaking we should be able to support metadata delete for any filter that doesn't touch non-partition columns. Today we only support it for range filters on partition columns though (regardless of whether filter pushdown is on or off). I'll add a comment and a TODO.

// Allow metadata delete for range filters on partition columns.
// TODO Add support for metadata delete for any filter on partition columns.

@mbasmanova mbasmanova merged commit 39a16b3 into prestodb:master Nov 16, 2019
@mbasmanova mbasmanova deleted the fix-metadata-delete branch November 16, 2019 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aria Presto Aria performance improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants