Skip to content

Conversation

@coryan
Copy link
Contributor

@coryan coryan commented Dec 11, 2017

This is another step to fix #30. It introduces more
functions to create filters, though these are less
common ones.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Dec 11, 2017
*
* TODO(#84) - document what is the effect of n <= 0
*/
static Filter Latest(std::int32_t n) {
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 use an unsigned int here, or is int32 the correct type to pass down the call stack?

Copy link
Contributor Author

@coryan coryan Dec 11, 2017

Choose a reason for hiding this comment

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

The rest of the stack expects an int32.

* TODO(#84) - document what is the effect of n <= 0
*/
static Filter CellsRowLimit(int n) {
static Filter CellsRowLimit(std::int32_t n) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment here re: unsigned, if possible.

Copy link
Contributor Author

@coryan coryan Dec 11, 2017

Choose a reason for hiding this comment

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

The rest of the stack expects an int32.

* TODO(#84) - document what is the effect of n <= 0
*/
static Filter CellsRowOffset(int n) {
static Filter CellsRowOffset(std::int32_t n) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment here re: unsigned, if possible.

Copy link
Contributor Author

@coryan coryan Dec 11, 2017

Choose a reason for hiding this comment

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

The rest of the stack expects an int32.

* TODO(#84) - decide what happens if the probability is out of range.
*
* @param probability the probability that any row will be selected. It
* must be in the [0.0, 1.0] range.
Copy link
Contributor

Choose a reason for hiding this comment

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

[...] must be in the range [0.0, 1.0].

but you can also simplify it to:

[...] must be in the range [0, 1].

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Did the first, I like making it explicit that is a floating point range, but will change if you feel strongly about it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Floating point range SGTM.

* different ranges the following functions are available.
*/
/**
* Return a filter that accepts values in the [@p start, @p end) range.
Copy link
Contributor

Choose a reason for hiding this comment

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

[...] values in the range [@p start, @p end).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

}

/**
* Return a filter that accepts columns in the (@p start, @p end) range
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

* Each value accepted by previous filters in modified to include the @p
* label.
*
* @note Currently it is not possible to apply more than one label in a
Copy link
Contributor

Choose a reason for hiding this comment

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

Currently, it is ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

* filter expression, that is, a chain can only contain a single
* ApplyLabelTransformer() filter. This limitation may be lifted in
* the future. It is possible to have multiple ApplyLabelTransformer
* filters in a Union() filter, though in this case each copy of a cell
Copy link
Contributor

Choose a reason for hiding this comment

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

, though in this case, each [...]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

*
* @param label the label applied to each cell. The labels must be at most 15
* characters long, and must match the `[a-z0-9\\-]` pattern.
* TODO(#84) - change this if we decide to validate inputs in the client side
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this TODO be automatically included in the documentation on the previous line for @param label? Did you want that to happen? Do we need a blank line between the arg doc comment and the TODO to dissociate them?

Same comment elsewhere, I've seen this pattern a few times.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Did not want that, thanks for catching it. Fixed, and looked for the pattern elsewhere too.

*
* TODO(#84) - document what happens if end < start
*/
static Filter ColumnRangeLeftOpen(std::string column_family,
Copy link
Contributor

Choose a reason for hiding this comment

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

@sduskis, @garye, @DanielMahu — do we actually support column range queries? I thought we only support row range queries, and column families and column qualifiers need to be specified explicitly, one at a time.

Copy link

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, got it, so column families are discrete (must be specified explicitly), while column qualifiers are continuous (can be selected individually, or via a range).

This is another step to fix googleapis#30.  It introduces more
functions to create filters, though these are less
common ones.
@coryan coryan force-pushed the fix-issue-30-implement-filters-p2 branch from dbf3fd3 to 904595b Compare December 11, 2017 23:59
@coryan
Copy link
Contributor Author

coryan commented Dec 15, 2017

Ping. @mbrukman I think I addressed the issues you raised. @garye can you take a look?

Copy link
Contributor

@mbrukman mbrukman left a comment

Choose a reason for hiding this comment

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

Minor comments, please feel free to squash + merge after you address them, though the style guide on comments should be added as a TODO somewhere, perhaps (in the style guide PR, maybe?).


/// Create a filter that accepts only the last @a n values.
static Filter Latest(int n) {
/**
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 have a pattern for when we use /** ... */ vs. when we use /// comments? Does Doxygen handle both of them? Do they behave differently somehow?

This should be documented in the style guide, and we should be consistent, assuming they are identical.

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 style guide proposed in #98 includes guidelines for when to use /** */ vs. /// and yes, Doxygen supports both.

* range. In most cases applications use [start,end) ranges, and the
* ValueRange() and ColumnRange() functions are offered to support the
* common case. For the less common cases where the application needs
* different ranges the following functions are available.
Copy link
Contributor

Choose a reason for hiding this comment

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

s/ranges the/ranges, the/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

* @name Less common range filters.
*
* Cloud Bigtable range filters can include or exclude the limits of the
* range. In most cases applications use [start,end) ranges, and the
Copy link
Contributor

Choose a reason for hiding this comment

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

s/start,end/start, end/ (add space after comma)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@coryan coryan merged commit 5a43f75 into googleapis:master Dec 18, 2017
@coryan coryan deleted the fix-issue-30-implement-filters-p2 branch December 18, 2017 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Design wrappers for filter expressions

4 participants