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 tests for overlapping ranges #428

Merged
merged 1 commit into from
Jun 15, 2022

Conversation

eddelbuettel
Copy link
Contributor

This PR adds tests for overlapping ranges in query conditions.

No new code.

@shortcut-integration
Copy link

This pull request has been linked to Shortcut Story #18608: Add tests for QueryCondition with overlapping ranges.

Copy link
Member

@aaronwolen aaronwolen left a comment

Choose a reason for hiding this comment

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

👍 with one question.

expect_equal(NROW(arr[]),
sum(with(penguins, year == 2009)))

qc <- parse_query_condition(year < 2009 || year < 2010)
Copy link
Member

@aaronwolen aaronwolen Jun 15, 2022

Choose a reason for hiding this comment

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

Shouldn't this be | rather than || for element-wise comparisons? Ditto for && 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.

Whooops. Excellent catch. Will fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, actually no: that is a 'token' for parse_query_condidtion() and not an R element-by-element operator.

Copy link
Member

Choose a reason for hiding this comment

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

Oh I see now:

TileDB-R/R/QueryCondition.R

Lines 132 to 135 in 8f1d2fa

.mapBoolToCharacter <- function(x) switch(x,
`&&` = "AND",
`||` = "OR",
`!` = "NOT")
.

Maybe we should translate |/& to ||/&& behind the scenes for R folks?

Copy link
Member

Choose a reason for hiding this comment

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

Actually, any reason not to use the short-form of these as the tokens for AND/OR? (Sorry, I know we've wandered away from the point of this PR).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Funny you went to the source, I did too :)

My feeling was we should definitely also support AND and OR (and, though currently a no-op) NOT. I feel less strongly about & and | but I suppose we could. In many other programming languages the double && or || is common which is why I went with it.

Maybe this discussion should be another issue or SC ticket. Lemme me merge this now first.

@eddelbuettel eddelbuettel merged commit 676fd7d into master Jun 15, 2022
@eddelbuettel eddelbuettel deleted the de/sc-18608/overlapping_ranges_tests branch June 15, 2022 15:24
@eddelbuettel eddelbuettel mentioned this pull request Jun 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants