Skip to content

Commit 91c9a5d

Browse files
authored
Support parentheses in query conditions (#771)
1 parent a9aaa58 commit 91c9a5d

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,6 @@ docs/articles/md/
4646
docs/articles/rmd/
4747
docs/articles/water.css
4848
vignettes/md/
49+
# vim
50+
.sw?
51+
.*.sw?

R/QueryCondition.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ parse_query_condition <- function(expr, ta=NULL, debug=FALSE, strict=TRUE, use_i
189189
.makeExpr <- function(x, debug=FALSE) {
190190
if (is.symbol(x)) {
191191
stop("Unexpected symbol in expression: ", format(x))
192+
} else if (x[[1]] == '(') {
193+
if (debug) cat("-- [(", as.character(x[2]), ")]\n", sep="")
194+
.makeExpr(x[[2]])
192195
} else if (.isBooleanOperator(x[1])) {
193196
if (debug) cat("-- [", as.character(x[2]), "]",
194197
" ", as.character(x[1]),

inst/tinytest/test_querycondition.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,10 @@ expect_equal(nrow(D), nrow(chk) + 2)
413413
chk <- tiledb_array(uri, query_condition=parse_query_condition(key == "ñ" || key == "Ø"), return_as="data.frame")[]
414414
expect_equal(nrow(chk), 2)
415415

416+
## include two with parentheses
417+
chk <- tiledb_array(uri, query_condition=parse_query_condition((key == "ñ") || (key == "Ø")), return_as="data.frame")[]
418+
expect_equal(nrow(chk), 2)
419+
416420

417421
## Test minimal version
418422
if (tiledb_version(TRUE) < "2.16.0") exit_file("Remainder needs 2.16.* or later")

0 commit comments

Comments
 (0)