From 041be97609a9d2d0f5d6dbd94f00cde48508eccc Mon Sep 17 00:00:00 2001 From: Dirk Eddelbuettel Date: Sat, 17 Sep 2022 09:44:53 -0500 Subject: [PATCH 1/2] Add parameterized test for SCALE_FLOAT --- inst/tinytest/test_filter.R | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/inst/tinytest/test_filter.R b/inst/tinytest/test_filter.R index f905dbd9a0..8ec04a56b0 100644 --- a/inst/tinytest/test_filter.R +++ b/inst/tinytest/test_filter.R @@ -170,4 +170,26 @@ for (name in name_list) { } } +## scale_float with parameters (cf test in TileDB-Py PR #1195) +if (tiledb_version(TRUE) >= "2.11.0") { + dat4 <- data.frame(BL=dat$bill_length_mm, + BD=dat$bill_depth_mm, + FL=as.double(dat$flipper_length_mm), + BM=as.double(dat$body_mass_g)) + pars <- expand.grid(factor=c(1,0.5,2), offset=0, bytewidth=c(1,0)) + for (i in seq_len(nrow(pars))) { + flt <- tiledb_filter("SCALE_FLOAT") + tiledb_filter_set_option(flt, "SCALE_FLOAT_FACTOR", pars[i, "factor"]) + tiledb_filter_set_option(flt, "SCALE_FLOAT_OFFSET", pars[i, "offset"]) + tiledb_filter_set_option(flt, "SCALE_FLOAT_BYTEWIDTH", pars[i, "bytewidth"]) + + uri <- file.path(tempdir()) + fromDataFrame(dat4, uri, filter=name) + res <- tiledb_array(uri, return_as="data.frame", extended=FALSE)[] + expect_equivalent(dat4, res, tolerance=5e-2) # note very high tolerance + + if (dir.exists(uri)) unlink(uri, recursive=TRUE) + } +} + rm(vfs) From 73a4473d7522a549dda6770b2e10ff72af4654a0 Mon Sep 17 00:00:00 2001 From: Dirk Eddelbuettel Date: Sat, 17 Sep 2022 10:08:39 -0500 Subject: [PATCH 2/2] Update NEWS.md [ci skip] --- NEWS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS.md b/NEWS.md index 716a18f2c2..de02cc67ad 100644 --- a/NEWS.md +++ b/NEWS.md @@ -28,6 +28,8 @@ * The test setup was refined for two filter tests (#467, #468) +* A parameterized test for the SCALE_FLOAT filter has been added (#469) + # tiledb 0.15.0