Skip to content

Add tests for overlapping ranges#428

Merged
eddelbuettel merged 1 commit intomasterfrom
de/sc-18608/overlapping_ranges_tests
Jun 15, 2022
Merged

Add tests for overlapping ranges#428
eddelbuettel merged 1 commit intomasterfrom
de/sc-18608/overlapping_ranges_tests

Conversation

@eddelbuettel
Copy link
Copy Markdown
Contributor

This PR adds tests for overlapping ranges in query conditions.

No new code.

@eddelbuettel eddelbuettel requested a review from ihnorton June 14, 2022 22:01
@shortcut-integration
Copy link
Copy Markdown

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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