File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed
Expand file tree Collapse file tree 2 files changed +20
-3
lines changed 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 @@ -1913,11 +1913,13 @@ XPtr<tiledb::ArraySchema> libtiledb_array_schema(
19131913 for (R_xlen_t i = 0 ; i < nenum; i++) {
19141914 bool nn = enumerations[i] == R_NilValue;
19151915 if (nn == false ) {
1916- XPtr<tiledb::Attribute> attr =
1917- as<XPtr<tiledb::Attribute>>(attributes[i]);
19181916 std::vector<std::string> enums =
19191917 as<std::vector<std::string>>(enumerations[i]);
19201918 std::string enum_name = std::string (enumnames[i]);
1919+
1920+ XPtr<tiledb::Attribute> attr =
1921+ as<XPtr<tiledb::Attribute>>(attributes[enum_name]);
1922+
19211923 bool is_ordered = false ; // default
19221924 // 'ordered' is an attribute off the CharacterVector
19231925 CharacterVector enumvect = enumerations[i];
You can’t perform that action at this time.
0 commit comments