Skip to content

Commit d977f0d

Browse files
Merge branch 'master' into memcpy-ro
2 parents bac01e7 + 0855d0a commit d977f0d

27 files changed

+174
-85
lines changed

.ci/atime/tests.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ test.list <- atime::atime_test_list(
117117
file.path("src", "init.c"),
118118
paste0("R_init_", Package_regex),
119119
paste0("R_init_", gsub("[.]", "_", new.Package_)))
120+
# allow compilation on new R versions where 'Calloc' is not defined
121+
pkg_find_replace(
122+
file.path("src", "*.c"),
123+
"\\b(Calloc|Free|Realloc)\\b",
124+
"R_\\1")
120125
pkg_find_replace(
121126
"NAMESPACE",
122127
sprintf('useDynLib\\("?%s"?', Package_regex),

.ci/linters/c/alloc_linter.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ alloc_linter = function(c_obj) {
66
lines = c_obj$lines
77
# Be a bit more precise to avoid mentions in comments, and allow
88
# malloc(0) to be used for convenience (e.g. #6757)
9-
alloc_lines = grep(R"{=\s*([(]\w+\s*[*][)])?[mc]alloc[(][^0]}", lines)
9+
alloc_lines = grep(R"{=\s*([(]\s*\w+\s*[*]\s*[)])?\s*[mc]alloc[(][^0]}", lines)
1010
if (!length(alloc_lines)) return()
1111
# int *tmp=(int*)malloc(...); or just int tmp=malloc(...);
1212
alloc_keys = lines[alloc_lines] |>
@@ -31,7 +31,7 @@ alloc_linter = function(c_obj) {
3131
cat("FILE: ", c_obj$path, "; LINES: ", head(bad_lines_idx, 1L), "-", tail(bad_lines_idx, 1L), "\n", sep="")
3232
writeLines(lines[bad_lines_idx])
3333
cat(strrep("-", max(nchar(lines[bad_lines_idx]))), "\n", sep="")
34-
stop("Expected the malloc()/calloc() usage above to be followed immediately by error checking.", call.=FALSE)
34+
stop("Expected the malloc()/calloc() usage above to be followed immediately by error checking (using '!', not '==NULL').", call.=FALSE)
3535
}
3636
})
3737
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@malloc_return_value_cast expression@
2+
type T;
3+
expression E;
4+
@@
5+
- (T)
6+
malloc(E)

.github/workflows/R-CMD-check.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ jobs:
2727
# GHA does run these jobs concurrently but even so reducing the load seems like a good idea.
2828
- {os: windows-latest, r: 'devel'}
2929
# - {os: macOS-latest, r: 'release'} # test-coverage.yaml uses macOS
30-
- {os: ubuntu-24.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
31-
# - {os: ubuntu-24.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest", http-user-agent: "R/4.1.0 (ubuntu-24.04) R (4.1.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" }
30+
# TODO(remotes>2.5.0): Use 24.04[noble?]
31+
- {os: ubuntu-22.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"}
32+
# - {os: ubuntu-22.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest", http-user-agent: "R/4.1.0 (ubuntu-22.04) R (4.1.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" }
3233
# GLCI covers R-devel; no need to delay contributors in dev due to changes in R-devel in recent days
3334

3435
env:
@@ -64,7 +65,7 @@ jobs:
6465
while read -r cmd
6566
do
6667
eval sudo $cmd
67-
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "24.04"))')
68+
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "22.04"))')
6869
6970
- name: Install dependencies
7071
run: |

CODEOWNERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
/src/programming.c @jangorecki
2424
/vignettes/datatable-programming.Rmd @jangorecki
2525

26+
# roll-up & setops
27+
/R/groupingsets.R @jangorecki
28+
/R/setops.R @jangorecki
29+
2630
# GForce groupby
2731
/src/gsumm.c @ben-schwen
2832
# datetime classes

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
2. `melt()` now supports using `patterns()` with `id.vars`, [#6867](https://github.com/Rdatatable/data.table/issues/6867). Thanks to Toby Dylan Hocking for the suggestion and PR.
1010

11+
3. `print.data.table()` now shows column classes at the bottom of large tables when `class=TRUE` and `col.names="auto"` (default) for tables with more than 20 rows, [#6902](https://github.com/Rdatatable/data.table/issues/6902). This follows the same behavior as column names at the bottom, making it easier to see column types for large tables without scrolling back to the top. Thanks to @TimTaylor for the suggestion and @Mukulyadav2004 for the PR.
12+
13+
4. `as.Date()` method for `IDate` no longer coerces to `double` [#6922](https://github.com/Rdatatable/data.table/issues/6922). Thanks @MichaelChirico for the report and PR. The only effect should be on overly-strict tests that assert `Date` objects have `double` storage, which is not in general true, especially from R 4.5.0.
14+
1115
## BUG FIXES
1216

1317
1. Custom binary operators from the `lubridate` package now work with objects of class `IDate` as with a `Date` subclass, [#6839](https://github.com/Rdatatable/data.table/issues/6839). Thanks @emallickhossain for the report and @aitap for the fix.

R/IDateTime.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ as.IDate.POSIXct = function(x, tz = attr(x, "tzone", exact=TRUE), ...) {
4646
as.IDate.IDate = function(x, ...) x
4747

4848
as.Date.IDate = function(x, ...) {
49-
x = as.numeric(x)
5049
class(x) = "Date"
5150
x
5251
}

R/data.table.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ replace_dot_alias = function(e) {
174174
stopf("When by and keyby are both provided, keyby must be TRUE or FALSE")
175175
}
176176
if (missing(by)) { missingby=TRUE; by=bysub=NULL } # possible when env is used, PR#4304
177-
else if (verbose && !is.null(env)) catf("Argument '%s' after substitute: %s\n", "by", paste(deparse(bysub, width.cutoff=500L), collapse=" "))
177+
else if (verbose && !is.null(env)) catf("Argument '%s' after substitute: %s\n", "by", paste(deparse(bysub, width.cutoff=500L), collapse="\n"))
178178
}
179179
bynull = !missingby && is.null(by) #3530
180180
byjoin = !is.null(by) && is.symbol(bysub) && bysub==".EACHI"
@@ -239,7 +239,7 @@ replace_dot_alias = function(e) {
239239
substitute2(.j, env),
240240
list(.j = substitute(j))
241241
))
242-
if (missing(jsub)) {j = substitute(); jsub=NULL} else if (verbose && !is.null(env)) catf("Argument '%s' after substitute: %s\n", "j", paste(deparse(jsub, width.cutoff=500L), collapse=" "))
242+
if (missing(jsub)) {j = substitute(); jsub=NULL} else if (verbose && !is.null(env)) catf("Argument '%s' after substitute: %s\n", "j", paste(deparse(jsub, width.cutoff=500L), collapse="\n"))
243243
}
244244
}
245245
if (!missing(j)) {
@@ -328,7 +328,7 @@ replace_dot_alias = function(e) {
328328
substitute2(.i, env),
329329
list(.i = substitute(i))
330330
))
331-
if (missing(isub)) {i = substitute(); isub=NULL} else if (verbose && !is.null(env)) catf("Argument '%s' after substitute: %s\n", "i", paste(deparse(isub, width.cutoff=500L), collapse=" "))
331+
if (missing(isub)) {i = substitute(); isub=NULL} else if (verbose && !is.null(env)) catf("Argument '%s' after substitute: %s\n", "i", paste(deparse(isub, width.cutoff=500L), collapse="\n"))
332332
}
333333
}
334334
if (!missing(i)) {
@@ -904,7 +904,7 @@ replace_dot_alias = function(e) {
904904
if (length(byvars) == 1L) tt = byvars
905905
else {
906906
# take the first variable that is (1) not eval (#3758) and (2) starts with a character that can't start a variable name
907-
tt = grep("^eval$|^[^[:alpha:]. ]", byvars, invert=TRUE, value=TRUE)
907+
tt = grepv("^eval$|^[^[:alpha:]. ]", byvars, invert=TRUE)
908908
# byvars but exclude functions or `0`+`1` becomes `+`
909909
tt = if (length(tt)) tt[1L] else all.vars(bysubl[[jj+1L]])[1L]
910910
}

R/print.data.table.R

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,11 @@ print.data.table = function(x, topn=getOption("datatable.print.topn"),
142142
if (nrow(toprint)>20L && col.names == "auto")
143143
# repeat colnames at the bottom if over 20 rows so you don't have to scroll up to see them
144144
# option to shut this off per request of Oleg Bondar on SO, #1482
145-
toprint = rbind(toprint, matrix(if (quote) old else colnames(toprint), nrow=1L)) # fixes bug #97
145+
toprint = rbind(
146+
toprint,
147+
matrix(if (quote) old else colnames(toprint), nrow=1L), # see #97
148+
if (isTRUE(class)) matrix(if (trunc.cols) abbs[cols_to_print] else abbs, nrow=1L) # #6902
149+
)
146150
print_default(toprint)
147151
invisible(x)
148152
}
@@ -165,7 +169,7 @@ shouldPrint = function(x) {
165169
# for removing the head (column names) of matrix output entirely,
166170
# as opposed to printing a blank line, for excluding col.names per PR #1483
167171
# be sure to remove colnames from any row where they exist, #4270
168-
cut_colnames = function(x) writeLines(grep("^\\s*(?:[0-9]+:|---)", capture.output(x), value=TRUE))
172+
cut_colnames = function(x) writeLines(grepv("^\\s*(?:[0-9]+:|---)", capture.output(x)))
169173

170174
# for printing the dims for list columns #3671; used by format.data.table()
171175
paste_dims = function(x) {

R/test.data.table.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ test = function(num,x,y=TRUE,error=NULL,warning=NULL,message=NULL,output=NULL,no
458458
# if a warning containing this string occurs, ignore it. First need for #4182 where warning about 'timedatectl' only
459459
# occurs in R 3.4, and maybe only on docker too not for users running test.data.table().
460460
stopifnot(is.character(ignore.warning), !anyNA(ignore.warning), nchar(ignore.warning)>=1L)
461-
for (msg in ignore.warning) observed = grep(msg, observed, value=TRUE, invert=TRUE) # allow multiple for translated messages rather than relying on '|' to always work
461+
for (msg in ignore.warning) observed = grepv(msg, observed, invert=TRUE) # allow multiple for translated messages rather than relying on '|' to always work
462462
}
463463
if (length(expected) != length(observed) && (!foreign || is.null(ignore.warning))) {
464464
# nocov start
@@ -515,6 +515,8 @@ test = function(num,x,y=TRUE,error=NULL,warning=NULL,message=NULL,output=NULL,no
515515
}
516516
if (!fail && !length(error) && (!length(output) || !missing(y))) { # TODO test y when output=, too
517517
capture.output(y <- try(y, silent=TRUE)) # y might produce verbose output, just toss it
518+
if (inherits(x, c("Date", "POSIXct"))) storage.mode(x) <- "numeric"
519+
if (inherits(y, c("Date", "POSIXct"))) storage.mode(y) <- "numeric"
518520
if (identical(x,y)) return(invisible(TRUE))
519521
all.equal.result = TRUE
520522
if (is.data.frame(x) && is.data.frame(y)) {

0 commit comments

Comments
 (0)