-
Notifications
You must be signed in to change notification settings - Fork 1k
DT[,foo:=bar]: earlier check for selfrefok
#7502
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
Conversation
The check needs to be there, not below, to detect non-selfrefok tables in by-group operations. Use static analysis to detect common forms of column deletion: foo := NULL and .(bar, baz) := .(NULL, NULL). Static analysis is doomed to miss things like frob := if (runif(1) < .5) 42 else NULL, but hopefully it covers the needs of our reverse dependencies.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7502 +/- ##
=======================================
Coverage 99.04% 99.04%
=======================================
Files 87 87
Lines 16699 16704 +5
=======================================
+ Hits 16539 16544 +5
Misses 160 160 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Generated via commit 5786d1f Download link for the artifact containing the test results: ↓ atime-results.zip
|
|
Fixes: DetailsBefore: dir.create('extrastuff/Library', FALSE, TRUE)
p <- c("bbotk", "blocking", "circhelp", "hicp", "metR", "mlr3tuning",
"SeaVal", "slim", "tidyrules", "tidytable", "ume", "webtrackR",
"DramaAnalysis")
download.packages(p, 'extrastuff')
install.packages('https://cran.r-project.org/incoming/waiting/data.table_1.18.0.tar.gz', lib = 'extras
tuff/Library')
tools::check_packages_in_dir('extrastuff', xvfb=TRUE, Ncpus=13)
tools::check_packages_in_dir_details('extrastuff') -> de_1.18
de_1.18 |> within(Status <- ordered(Status, c('OK','NOTE','WARNING','ERROR'))) |> aggregate(Status ~ Package, max)After: install.packages('data.table_1.17.99.tar.gz', lib = 'extrastuff/Library')
tools::check_packages_in_dir('extrastuff', xvfb=TRUE, Ncpus=13)
tools::check_packages_in_dir_details('extrastuff') -> de_pr7502
de_pr7502 |> within(Status <- ordered(Status, c('OK','NOTE','WARNING','ERROR'))) |> aggregate(Status ~ Package, max)subset(de_pr7502, Status != 'OK') # unrelated to data.tableWhat if we checked for new columns before ordinary/by-group evaluation and additionally checked for column removal after ordinary evaluation? |
HughParsonage
left a comment
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.
If by is absent, then evaluate jsub to materialize jval then inspect jval for NULL then setalloc.
Just to avoid this triggering other regressions if people have been using symbols to refer to NULL programmatically rather than syntactically
| if (is.name(name)) { | ||
| assign(as.character(name), x, parent.frame(), inherits=TRUE) | ||
| } | ||
| } |
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.
Thank you! With this commit, the 13 packages flagged for this issue pass their R CMD checks with nothing worse than NOTE.
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.
Nice! I guess we need to battle test this throughly but as a bandaid it should hold

Kludge towards #7498; amends #6789 and an earlier half-fix, #7488. Maybe it gives someone a better idea, I don't know. It does fix
bbotk.The check needs to happen before
eval(jsub)/.Call(dogroups)because the latter will try to assign the results into the table, potentially trying to resize the number of columns.Use static analysis to detect common forms of column deletion:
foo := NULLandc("bar", "baz") := .(NULL, NULL). Static analysis is doomed to miss things likefrob := if (runif(1) < .5) 42 else NULL, but hopefully it covers the needs of our reverse dependencies.