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
// modify DT by reference. Other than if new columns are being added and the allocVec() fails with
516
516
// out-of-memory. In that case the user will receive hard halt and know to rerun.
517
517
if (length(newcolnames)) {
518
-
oldtncol=is_growable(dt) ? growable_max_size(dt) : 0; // TO DO: oldtncol can be just called tl now, as we won't realloc here any more.
518
+
oldtncol=is_growable(dt) ? growable_capacity(dt) : 0; // TO DO: oldtncol can be just called tl now, as we won't realloc here any more.
519
519
520
520
if (oldtncol<oldncol) {
521
521
if (oldtncol==0) error(_("This data.table has either been loaded from disk (e.g. using readRDS()/load()) or constructed manually (e.g. using structure()). Please run setDT() or setalloccol() on it first (to pre-allocate space for new columns) before assigning by reference to it.")); // #2996
error(_("It appears that at some earlier point, names of this data.table have been reassigned. Please ensure to use setnames() rather than names<- or colnames<-. Otherwise, please report to data.table issue tracker.")); // # nocov
529
529
// Can growVector at this point easily enough, but it shouldn't happen in first place so leave it as
530
530
// strong error message for now.
531
-
elseif (growable_max_size(names) !=oldtncol)
531
+
elseif (growable_capacity(names) !=oldtncol)
532
532
// Use (long long) to cast R_xlen_t to a fixed type to robustly avoid -Wformat compiler warnings, see #5768, PRId64 didn't work
533
-
internal_error(__func__, "selfrefnames is ok but tl names [%lld] != tl [%d]", (long long)growable_max_size(names), oldtncol); // # nocov
533
+
internal_error(__func__, "selfrefnames is ok but tl names [%lld] != tl [%d]", (long long)growable_capacity(names), oldtncol); // # nocov
534
534
if (!selfrefok(dt, verbose)) // #6410 setDT(dt) and subsequent attr<- can lead to invalid selfref
535
535
error(_("It appears that at some earlier point, attributes of this data.table have been reassigned. Please use setattr(DT, name, value) rather than attr(DT, name) <- value. If that doesn't apply to you, please report your case to the data.table issue tracker."));
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
320
+
if (growable_capacity(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
321
321
target=PROTECT(allocNAVectorLike(RHS, n));
322
322
// Even if we could know reliably to switch from allocNAVectorLike to allocVector for slight speedup, user code could still
323
323
// contain a switched halt, and in that case we'd want the groups not yet done to have NA rather than 0 or uninitialized.
0 commit comments