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
The resulting data.tables now have GROWABLE_BIT set, therefore:
- the finalizer is not needed on R >= 3.4
- duplicates of data.tables (which are not over-allocated) now have
TRUELENGTH of 0 instead of whatever it was before, which is detected
earlier in selfrefok()
As a result, assign.c only uses TRUELENGTH on R < 3.4.
// modify DT by reference. Other than if new columns are being added and the allocVec() fails with
515
521
// out-of-memory. In that case the user will receive hard halt and know to rerun.
516
522
if (length(newcolnames)) {
517
-
oldtncol=TRUELENGTH(dt); // TO DO: oldtncol can be just called tl now, as we won't realloc here any more.
523
+
oldtncol=growable_max_size(dt); // TO DO: oldtncol can be just called tl now, as we won't realloc here any more.
518
524
519
525
if (oldtncol<oldncol) {
520
526
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
528
534
// Can growVector at this point easily enough, but it shouldn't happen in first place so leave it as
529
535
// strong error message for now.
530
-
elseif (TRUELENGTH(names) !=oldtncol)
536
+
elseif (growable_max_size(names) !=oldtncol)
531
537
// Use (long long) to cast R_xlen_t to a fixed type to robustly avoid -Wformat compiler warnings, see #5768, PRId64 didn't work
532
-
internal_error(__func__, "selfrefnames is ok but tl names [%lld] != tl [%d]", (long long)TRUELENGTH(names), oldtncol); // # nocov
538
+
internal_error(__func__, "selfrefnames is ok but tl names [%lld] != tl [%d]", (long long)growable_max_size(names), oldtncol); // # nocov
533
539
if (!selfrefok(dt, verbose)) // #6410 setDT(dt) and subsequent attr<- can lead to invalid selfref
534
540
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."));
0 commit comments