Skip to content

tiledb 0.9.1 drops rows and cols when attrs= is specified #244

@LTLA

Description

@LTLA

I'll use the example generated by ex_1.R. (Note that I needed to add names to the list at:

data <- list(array(seq(1:50), dim = c(10,5)),
array(as.double(seq(101,by=0.5,length=50)), dim = c(10,5)),
array(c(letters[1:26], "brown", "fox", LETTERS[1:22]), dim = c(10,5)))

Otherwise it complains Error: No column names supplied.)

Anyway, once ex_1/ is generated, we can run the following code in 0.9.1 (8cca43b):

> library(tiledb)
> obj <- tiledb_array("ex_1/", as.data.frame=TRUE)
> head(obj[])
  rows cols  a     b c
1    1    1  1 101.0 a
2    1    2 11 106.0 k
3    1    3 21 111.0 u
4    1    4 31 116.0 C
5    1    5 41 121.0 M
6    2    1  2 101.5 b
> obj <- tiledb_array("ex_1/", attrs="a", as.data.frame=TRUE)
> head(obj[])
[1]  1 11 21 31 41  2
> obj <- tiledb_array("ex_1/", attrs=c("a", "b"), as.data.frame=TRUE)
> head(obj[])
   a     b
1  1 101.0
2 11 106.0
3 21 111.0
4 31 116.0
5 41 121.0
6  2 101.5

You can see how specifying attrs= causes the rows and cols columns to be removed, and eventually for the data frame structure to be dropped altogether if attrs is of length 1. This is pretty surprising for downstream code that expects to see the rows and cols columns for further manipulation of the indices.

For comparison, this is what I see on 0.9.0 (20e775c):

> obj <- tiledb_array("ex_1/", as.data.frame=TRUE)
> head(obj[])
  rows cols  a     b c
1    1    1  1 101.0 a
2    1    2 11 106.0 k
3    1    3 21 111.0 u
4    1    4 31 116.0 C
5    1    5 41 121.0 M
6    2    1  2 101.5 b
> obj <- tiledb_array("ex_1/", attrs="a", as.data.frame=TRUE)
> head(obj[])
  rows cols  a
1    1    1  1
2    1    2 11
3    1    3 21
4    1    4 31
5    1    5 41
6    2    1  2
> obj <- tiledb_array("ex_1/", attrs=c("a", "b"), as.data.frame=TRUE)
> head(obj[])
  rows cols  a     b
1    1    1  1 101.0
2    1    2 11 106.0
3    1    3 21 111.0
4    1    4 31 116.0
5    1    5 41 121.0
6    2    1  2 101.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions