Skip to content

Conversation

@cgiachalis
Copy link
Contributor

@cgiachalis cgiachalis commented Oct 14, 2025

This PR fixes #853.

For complete testing please use the included unit tests.

library(tiledb)

dom <- tiledb_domain(c(tiledb_dim(
  name = "id",
  domain = c(NULL, NULL),
  tile = NULL,
  type = "ASCII")))

attrs <- c(
  
  tiledb_attr(
    name = "col1",
    type = "INT32",
    ncells = 1,
    nullable = FALSE),
  tiledb_attr(
    name = "enum1",
    type = "INT32",
    ncells = 1,
    nullable = FALSE,
    enumeration = TRUE
  ),
  tiledb_attr(
    name = "col2",
    type = "INT32",
    ncells = 1,
    nullable = FALSE
  ),
  tiledb_attr(
    name = "enum2",
    type = "INT32",
    ncells = 1,
    nullable = FALSE,
    enumeration = TRUE
  ),
  tiledb_attr(
    name = "enum3",
    type = "INT32",
    ncells = 1,
    nullable = FALSE,
    enumeration = TRUE
  )
)

# case 1 (ordered enums)
uri <- tempfile()

enums <- list(
  enum1 =  c("A", "B"),
  enum2 = c("yes", "no"),
  enum3 = c("aa")
)

sch <- tiledb_array_schema(domain = dom, attrs = attrs, sparse = TRUE, enumerations = enums)
tiledb_array_create(uri, sch)
arr <- tiledb_array(uri)

tiledb_array_has_enumeration(arr)

Before

#>  col1 enum1  col2 enum2 enum3 
#>  TRUE  TRUE  TRUE  TRUE  TRUE

After

#>  col1 enum1  col2 enum2 enum3 
#> FALSE  TRUE FALSE  TRUE  TRUE 

@cgiachalis cgiachalis changed the title Fix 'tiledb_array_schema()' enumeration mapping Fix tiledb_array_schema() enumeration mapping Oct 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue on adding enums via tiledb_array_schema()

1 participant