File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -114,7 +114,22 @@ tiledb_array_schema <- function(
114114 )
115115 # if (allows_dups && !sparse) stop("'allows_dups' requires 'sparse' TRUE")
116116
117- attr_ptr_list <- if (is.list(attrs )) lapply(attrs , function (obj ) slot(obj , " ptr" )) else list ()
117+ if (is.list(attrs )) {
118+ attr_names <- sapply(attrs , name )
119+ attr_ptr_list <- lapply(attrs , function (obj ) slot(obj , " ptr" ))
120+ names(attr_ptr_list ) <- attr_names
121+
122+ # Do not allow enum named list to have different names than attributes
123+ if (! is.null(enumerations )) {
124+ if (! all(names(enumerations ) %in% attr_names )) {
125+ stop(" 'enumerations' should be a named list mapped to attributes names" )
126+ }
127+ }
128+
129+ } else {
130+ attr_ptr_list <- list ()
131+ }
132+
118133 coords_filter_list_ptr <- if (! is.null(coords_filter_list )) coords_filter_list @ ptr else NULL
119134 offsets_filter_list_ptr <- if (! is.null(offsets_filter_list )) offsets_filter_list @ ptr else NULL
120135 validity_filter_list_ptr <- if (! is.null(validity_filter_list )) validity_filter_list @ ptr else NULL
Original file line number Diff line number Diff line change @@ -1914,11 +1914,13 @@ XPtr<tiledb::ArraySchema> libtiledb_array_schema(
19141914 for (R_xlen_t i = 0 ; i < nenum; i++) {
19151915 bool nn = enumerations[i] == R_NilValue;
19161916 if (nn == false ) {
1917- XPtr<tiledb::Attribute> attr =
1918- as<XPtr<tiledb::Attribute>>(attributes[i]);
19191917 std::vector<std::string> enums =
19201918 as<std::vector<std::string>>(enumerations[i]);
19211919 std::string enum_name = std::string (enumnames[i]);
1920+
1921+ XPtr<tiledb::Attribute> attr =
1922+ as<XPtr<tiledb::Attribute>>(attributes[enum_name]);
1923+
19221924 bool is_ordered = false ; // default
19231925 // 'ordered' is an attribute off the CharacterVector
19241926 CharacterVector enumvect = enumerations[i];
You can’t perform that action at this time.
0 commit comments