-
Notifications
You must be signed in to change notification settings - Fork 1k
set automatically allocates new column slots if needed #7538
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
No obvious timing issues in HEAD=set_automate_overalloc Generated via commit 76675c3 Download link for the artifact containing the test results: ↓ atime-results.zip
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7538 +/- ##
=======================================
Coverage 98.97% 98.97%
=======================================
Files 87 87
Lines 16733 16733
=======================================
Hits 16561 16561
Misses 172 172 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| test(2356.2, options=c(datatable.alloccol=1L), set(DT, j="c", value=3), data.table(a=1, b=2, c=3)) | ||
| # ensure := and set are consistent if they need to overallocate | ||
| DT = data.table(); DT2 = data.table() | ||
| test(2356.3, options=c(datatable.alloccol=1L), {for (i in seq(10L)) set(DT, j = paste0("V",i), value = i)}, {for (i in seq(10)) DT2[, sprintf("V%d",i) := i]}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need ; DT and ; DT2 here, a for loop returns NULL so now the test just checks the code runs:
x = for (i in 1:10) i
dput(x)
# NULL
| { | ||
| # If removing columns from a table that's not selfrefok, need to call setalloccol first, #7488 | ||
| if ((is.null(value) || (is.list(value) && any(vapply_1b(value, is.null)))) && selfrefok(x, verbose=FALSE) < 1L) { | ||
| if (((is.null(value) || (is.list(value) && any(vapply_1b(value, is.null)))) && selfrefok(x, verbose=FALSE) < 1L) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
too many parentheses :)
I propose this helper:
.set_needs_alloccol = function(x, value) {
if (truelength(x) <= length(x)) return(TRUE)
if (selfrefok(x, verbose=FALSE) >= 1L) return(FALSE)
if (is.null(value)) return(TRUE)
if (!is.list(value)) return(FALSE)
any(vapply_1b(value, is.null))
}
Closes #1831
Closes #4100
Supersedes #5269
Originally posted by @MichaelChirico in #5269 (comment)
Basically yes, but we have to carry this ball anyway because of #7500