You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since dogroups() relies on being able to shrink vectors it hasn't
allocated, introduce make_growable() and is_growable() to adapt. Since
dogroups() relies on SD and SDall having shared columns, use the
setgrowable() wrapper on the R side at the time when SD and SDall are
being created.
(In the ALTREP case, setgrowable() will re-create the columns.)
SDenv$.SDall= .Call(CsubsetDT, x, if (length(len__)) seq_len(max(len__)) else0L, xcols) # must be deep copy when largest group is a subset
1592
1593
if (!is.data.table(SDenv$.SDall)) setattr(SDenv$.SDall, "class", c("data.table","data.frame")) # DF |> DT(,.SD[...],by=grp) needs .SD to be data.table, test 2022.012
1593
1594
if (xdotcols) setattr(SDenv$.SDall, 'names', ansvars[xcolsAns]) # now that we allow 'x.' prefix in 'j', #2313 bug fix - [xcolsAns]
// Resize a growable vector to newsize. Will signal an error if newsize exceeds max_size.
307
307
voidgrowable_resize(SEXPx, R_xlen_tnewsize);
308
+
// Return TRUE if growable_resize(x) and growable_max_size(x) are valid operations.
309
+
Rbooleanis_growable(SEXPx);
310
+
// Transform x into a growable vector. The return value must be reprotected in place of x. What happens to x is deliberately not specified, but no copying occurs.
311
+
SEXPmake_growable(SEXPx);
308
312
309
313
// functions called from R level .Call/.External and registered in init.c
310
314
// these now live here to pass -Wstrict-prototypes, #5477
if (TRUELENGTH(dt) <colj+1) internal_error(__func__, "Trying to add new column by reference but tl is full; setalloccol should have run first at R level before getting to this point"); // # nocov
321
+
if (growable_max_size(dt) <colj+1) internal_error(__func__, "Trying to add new column by reference but table is full; setalloccol should have run first at R level before getting to this point"); // # nocov
322
322
target=PROTECT(allocNAVectorLike(RHS, n));
323
323
// Even if we could know reliably to switch from allocNAVectorLike to allocVector for slight speedup, user code could still
324
324
// contain a switched halt, and in that case we'd want the groups not yet done to have NA rather than 0 or uninitialized.
325
325
// Increment length only if the allocation passes, #1676. But before SET_VECTOR_ELT otherwise attempt-to-set-index-n/n R error
0 commit comments