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

Add filtering ability for all backend API ListXXX requests #537

Merged
merged 12 commits into from
Dec 14, 2018

Conversation

neuromage
Copy link
Contributor

@neuromage neuromage commented Dec 13, 2018

This PR adds filtering capability to all ListXXX requests in the backend API. As the context for filtering needs to be preserved with that of sorting, I've unified both under the new 'list' package, which attempts to streamline the previous logic for sorting and generating next page tokens. High-level overview of what's in this PR:

  • Introduce the Filter protocol buffer which is used to transmit filtering requests from the frontend to the backend.
  • The package filter handles parsing the Filter proto and is able to apply corresponding WHERE clauses when constructing SQL statements.
  • The package list handles both sorting and filtering, and is used by all ListXXX requests down the stack. It generates next page tokens to ensure both sorting and filtering criteria carries over to the next page of results.
  • All models implement list.Listable, which defines a minimal interface that needs to be satisfied by any model that supports list operations.

This change is Reviewable

@neuromage
Copy link
Contributor Author

/cc @yebrahim
/assign @yebrahim

@neuromage
Copy link
Contributor Author

/cc @yebrahim

@neuromage
Copy link
Contributor Author

/assign @IronPan

@vicaire
Copy link
Contributor

vicaire commented Dec 14, 2018

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vicaire

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Contributor

@yebrahim yebrahim left a comment

Choose a reason for hiding this comment

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

[still reviewing] just a few comments/clarifications

LESS_THAN_EQUALS = 7;

// Checks if the value is a member of a given array, which should be one of
// |int_values|, |long_values| or |string_values|.
Copy link
Contributor

Choose a reason for hiding this comment

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

But not timestamp_value? If there is a good reason for this, we should point it out here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's no good reason other than I thought it unlikely we'd want to query specific dates vs a range of dates. If we ever want to do so, we can add it easily.

// }
// }
message Filter {
// All predicates are AND-ed when this filter is applied.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Does this description really belong here? This seems to me like a backend logic contract rather than protocol, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The logic of the filter is part of the contract, so I think having it here is useful for anyone trying to create a Filter proto.


string key = 2;
oneof value {
int32 int_value = 3;
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is needed for a service interface. Clients usually aren't very careful about numeric type accuracy (not to mention our clients are dynamically typed languages anyway).
Is it safe to say that unless this proto is to be used between backend services, it doesn't make sense to use integers anywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think so. The client can be in any language that supports protos, like Go. In which case types do matter.

@k8s-ci-robot k8s-ci-robot merged commit 0c0d8a2 into kubeflow:master Dec 14, 2018
@neuromage
Copy link
Contributor Author

@yebrahim I can send out another PR with changes if you'd like me to make any. Please let me know. Thanks!

@yebrahim
Copy link
Contributor

I don't have very strong opinions on the comments here, so I'm fine with these resolutions.
Thanks for making the change!

@neuromage neuromage deleted the filtering-api branch December 17, 2018 22:16
@neuromage neuromage restored the filtering-api branch December 22, 2018 21:34
HumairAK pushed a commit to red-hat-data-services/data-science-pipelines that referenced this pull request Mar 11, 2024
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.

5 participants