File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33# proxy/restore
44# This is inefficient but seemingly required for vctrs machinery
55method(vec_proxy , class_vecvec ) <- function (x , ... ) {
6- data_frame(x = list (x @ x ), i = S7_data(x ))
6+ data_frame(x = list (x @ x ), l = sum(lengths( x @ x )), i = S7_data(x ))
77}
88method(vec_restore , class_vecvec ) <- function (x , to , ... ) {
9+ if (is_vecvec(x )) return (x )
910 if (vec_size(x ) == 0L ) {
1011 return (S7_class(to )())
1112 }
1213
14+ # Fast path for vecvec without merging - just update the indices
15+ if (identical(sum(slot_len <- lengths(to @ x )), slot_grp <- unique(x $ l ))) {
16+ S7_data(to ) <- x $ i
17+ # Invoke pruning of slots
18+ out <- to [seq_along(to )]
19+ attributes(out ) <- attributes(to )
20+ return (out )
21+ }
22+
1323 # Identify groups of vectors
1424 # TODO - this destroys altrep
1525 grp <- vec_group_loc(x $ x )
You can’t perform that action at this time.
0 commit comments