-
Notifications
You must be signed in to change notification settings - Fork 23
[<- misinterprets 3-column matrix as sparse triplets for dense arrays #878
Copy link
Copy link
Open
Description
Filing this based on the suggestion in LTLA/TileDBArray#31. Related to #877.
When assigning a matrix with exactly 3 columns to a dense tiledb_array, [<- converts the matrix to a data.frame and then misinterprets it as sparse coordinate triplets (row, column, value). Matrices with any other number of columns (e.g., 2, 4, 5) work correctly.
Minimal reproducible example
library(tiledb)
tmp <- tempfile()
dom <- tiledb_domain(dims = list(
tiledb_dim("d1", c(1L, 4L), 4L, type = "INT32"),
tiledb_dim("d2", c(1L, 3L), 3L, type = "INT32")
))
schema <- tiledb_array_schema(
dom,
attrs = list(tiledb_attr("x", type = "FLOAT64")),
sparse = FALSE
)
tiledb_array_create(tmp, schema)
# 3 columns: FAIL
arr <- tiledb_array(tmp, query_type = "WRITE")
arr[1:4, 1:3] <- matrix(runif(12), 4, 3)
#> Error: Assigned data.frame does not contain all required
#> attribute and dimension columns.
tiledb_array_close(arr)
# Changing the second dimension to anything other than 3 (e.g., 5) works
fine:
tmp2 <- tempfile()
dom2 <- tiledb_domain(dims = list(
tiledb_dim("d1", c(1L, 4L), 4L, type = "INT32"),
tiledb_dim("d2", c(1L, 5L), 5L, type = "INT32")
))
schema2 <- tiledb_array_schema(
dom2,
attrs = list(tiledb_attr("x", type = "FLOAT64")),
sparse = FALSE
)
tiledb_array_create(tmp2, schema2)
arr2 <- tiledb_array(tmp2, query_type = "WRITE")
arr2[1:4, 1:5] <- matrix(runif(20), 4, 5)
#> OK
tiledb_array_close(arr2)
# Session info
tiledb 0.34.0
R 4.5.3
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels