Skip to content

Commit 5a6552a

Browse files
authored
Always use nzvals to extracting sparse data during writes. (#29)
nzvals/nzwhich now work on any SparseArray derivative (i.e. COO_SparseArray and SVT_SparseArray objects) and sparse representations from the Matrix package.
1 parent 4239c60 commit 5a6552a

File tree

3 files changed

+6
-13
lines changed

3 files changed

+6
-13
lines changed

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: TileDBArray
2-
Version: 1.19.0
3-
Date: 2024-10-01
2+
Version: 1.19.1
3+
Date: 2025-06-19
44
Title: Using TileDB as a DelayedArray Backend
55
Description: Implements a DelayedArray backend for reading and
66
writing dense or sparse arrays in the TileDB format. The

NAMESPACE

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ importFrom(S4Vectors,isSingleString)
4545
importFrom(S4Vectors,setValidity2)
4646
importFrom(SparseArray,COO_SparseArray)
4747
importFrom(SparseArray,extract_sparse_array)
48-
importFrom(SparseArray,nzcoo)
49-
importFrom(SparseArray,nzdata)
48+
importFrom(SparseArray,nzvals)
5049
importFrom(SparseArray,nzwhich)
5150
importFrom(methods,show)

R/TileDBRealizationSink.R

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -207,22 +207,16 @@ setValidity2("TileDBRealizationSink", function(object) {
207207

208208
#' @export
209209
#' @importClassesFrom SparseArray COO_SparseArray
210-
#' @importFrom SparseArray nzcoo nzdata nzwhich
210+
#' @importFrom SparseArray nzwhich nzvals
211211
#' @importFrom DelayedArray start width
212212
setMethod("write_block", "TileDBRealizationSink", function(sink, viewport, block) {
213213
starts <- start(viewport) - 1L
214214
obj <- tiledb_array(sink@path, attrs=sink@attr, query_type="WRITE")
215215
on.exit(tiledb_array_close(obj))
216216

217217
if (sink@sparse) {
218-
# Need this because COO_SparseArray doesn't support [.
219-
if (is(block, "COO_SparseArray")) {
220-
idx <- nzcoo(block)
221-
vals <- nzdata(block)
222-
} else {
223-
idx <- nzwhich(block, arr.ind=TRUE)
224-
vals <- block[idx]
225-
}
218+
idx <- nzwhich(block, arr.ind=TRUE)
219+
vals <- nzvals(block)
226220

227221
ndim <- ncol(idx)
228222
store <- vector("list", ndim + 1L)

0 commit comments

Comments
 (0)