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

Correct treatment of character columns with missing values #454

Merged
merged 3 commits into from
Aug 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: tiledb
Type: Package
Version: 0.15.0.1
Version: 0.15.0.2
Title: Universal Storage Engine for Sparse and Dense Multidimensional Arrays
Authors@R: c(person("TileDB, Inc.", role = c("aut", "cph")),
person("Dirk", "Eddelbuettel", email = "dirk@tiledb.com", role = "cre"))
Expand Down
14 changes: 14 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Ongoing Development

## Improvements

* Several deprecated API entry points of TileDB Embedded are no longer used (#452, #453)

## Bug Fixes

* Treatment of character columns with missing values has been corrected (#454)

## Build and Test Systems



# tiledb 0.15.0

* This release of the R package builds against [TileDB 2.11.0](https://github.com/TileDB-Inc/TileDB/releases/tag/2.11.0), and has also been tested against earlier releases as well as the development version.
Expand Down
11 changes: 11 additions & 0 deletions inst/tinytest/test_tiledbarray.R
Original file line number Diff line number Diff line change
Expand Up @@ -1463,3 +1463,14 @@ expect_false(completedBatched(lst))
res4 <- tiledb:::fetchBatched(arr, lst)
expect_true(completedBatched(lst))
expect_equal(nrow(res1) + nrow(res2) + nrow(res3) + nrow(res4), 344)


## check NAs in character column
library(palmerpenguins)
uri <- tempfile()
fromDataFrame(penguins, uri, sparse = TRUE, col_index = c("species", "year"))
pp <- tiledb_array(uri, return_as="data.frame")[]
oo <- penguins
expect_equal(sum(is.na(oo$sex)), sum(is.na(pp$sex)))
expect_equal(sum(oo$sex == "male"), sum(pp$sex == "male"))
expect_equal(sum(oo$sex == "female"), sum(pp$sex == "female"))
10 changes: 7 additions & 3 deletions src/libtiledb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2689,10 +2689,14 @@ CharacterMatrix libtiledb_query_get_buffer_var_char(XPtr<vlc_buf_t> bufptr,
// Get the strings
CharacterMatrix mat(bufptr->rows, bufptr->cols);
for (size_t i = 0; i < n; i++) {
if (!bufptr->nullable || bufptr->validity_map[i] == 1)
if (bufptr->nullable) {
if (bufptr->validity_map[i] == 0)
mat[i] = std::string(&bufptr->str[bufptr->offsets[i]], str_sizes[i]);
else
mat[i] = R_NaString;
} else {
mat[i] = std::string(&bufptr->str[bufptr->offsets[i]], str_sizes[i]);
else
mat[i] = R_NaString;
}
}
return(mat);
}
Expand Down