Skip to content

Commit bd69f6f

Browse files
authored
Merge branch 'master' into issue6846
2 parents a9c5ff3 + 3afc750 commit bd69f6f

File tree

14 files changed

+59
-46
lines changed

14 files changed

+59
-46
lines changed

.dev/lsan.supp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
leak:libfontconfig.so

.gitlab-ci.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,24 @@ test-lin-ancient-cran:
212212
# Restore checking vignettes if upgrading our R dependency means knitr can be installed.
213213
- R CMD check --no-manual --no-build-vignettes --ignore-vignettes $(ls -1t data.table_*.tar.gz | head -n 1)
214214

215+
# run the main checks with Address(+Leak),UBSanitizer enabled
216+
test-lin-san:
217+
<<: *test-lin
218+
image: registry.gitlab.com/rdatatable/dockerfiles/r-devel-clang-san
219+
variables:
220+
# must be set for most of the process because there are pseudo-leaks everywhere
221+
ASAN_OPTIONS: "detect_leaks=0"
222+
# fontconfig is known to leak; add more suppressions as discovered
223+
LSAN_OPTIONS: "suppressions=$CI_PROJECT_DIR/.dev/lsan.supp"
224+
UBSAN_OPTIONS: "print_stacktrace=1"
225+
script:
226+
- *install-deps
227+
- |
228+
res1=0; ASAN_OPTIONS=detect_leaks=1 R CMD check --no-manual $(ls -1t data.table_*.tar.gz | head -n 1) || res1=$?
229+
res2=0; perl -nle '(print, $a=1) if /: runtime error: |ERROR: LeakSanitizer/../SUMMARY.*Sanitizer/ }{ exit $a' data.table.Rcheck/**/*.Rout* || res2=$?
230+
# fail if R CMD check had failed or if sanitizer output found
231+
if [ $res1 -ne 0 ] || [ $res2 -ne 0 ]; then exit 1; fi
232+
215233
.test-win-template: &test-win
216234
<<: *test
217235
tags:
@@ -311,7 +329,7 @@ integration:
311329
- saas-linux-medium-amd64
312330
only:
313331
- master
314-
needs: ["mirror-packages","build","test-lin-rel","test-lin-rel-cran","test-lin-dev-gcc-strict-cran","test-lin-dev-clang-cran","test-lin-rel-vanilla","test-lin-ancient-cran","test-win-rel","test-win-dev" ,"test-win-old","test-mac-rel","test-mac-old"]
332+
needs: ["mirror-packages","build","test-lin-rel","test-lin-rel-cran","test-lin-dev-gcc-strict-cran","test-lin-dev-clang-cran","test-lin-rel-vanilla","test-lin-ancient-cran","test-lin-san","test-win-rel","test-win-dev" ,"test-win-old","test-mac-rel","test-mac-old"]
315333
script:
316334
- R --version
317335
- *install-deps ## markdown pkg not present in r-pkgdown image

NEWS.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,19 @@
1212

1313
2. `fwrite(compress="gzip")` once again produces a gzip header when the column names are missing or disabled, [@6852](https://github.com/Rdatatable/data.table/issues/6852). Thanks @maxscheiber for the report and @aitap for the fix.
1414

15+
3. `fread(keepLeadingZeros=TRUE)` now correctly parses dates with components with leading zeros as dates instead of strings, [#6851](https://github.com/Rdatatable/data.table/issues/6851). Thanks @TurnaevEvgeny for the report and @ben-schwen for the fix.
16+
1517
## NOTES
1618

1719
1. Continued work to remove non-API C functions, [#6180](https://github.com/Rdatatable/data.table/issues/6180). Thanks Ivan Krylov for the PRs and for writing a clear and concise guide about the R API: https://aitap.codeberg.page/R-api/.
1820

21+
2. The following in-progress deprecations have proceeded:
22+
23+
+ Argument `logicalAsInt` to `fwrite()` has been removed.
24+
+ Argument `autostart` to `fread()` has been removed.
25+
+ Argument `in.place` to `droplevels` has been removed.
26+
+ It's now an error to set `datatable.nomatch`, which has been warning since 1.15.0.
27+
1928
# data.table [v1.17.0](https://github.com/Rdatatable/data.table/milestone/34) (20 Feb 2025)
2029

2130
## POTENTIALLY BREAKING CHANGES

R/data.table.R

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -686,10 +686,7 @@ replace_dot_alias = function(e) {
686686
if (is.null(jsub)) return(NULL)
687687

688688
if (!with) {
689-
if (jsub %iscall% ":=") {
690-
# TODO(>=1.18.0): Simplify this error
691-
stopf("with=FALSE together with := was deprecated in v1.9.4 released Oct 2014; this has been warning since v1.15.0. Please wrap the LHS of := with parentheses; e.g., DT[,(myVar):=sum(b),by=a] to assign to column name(s) held in variable myVar. See ?':=' for other examples.")
692-
}
689+
if (jsub %iscall% ":=") stopf("`:=` is only supported under with=TRUE, see ?`:=`.")
693690
# missingby was already checked above before dealing with i
694691
if (jsub %iscall% c("!", "-") && length(jsub)==2L) { # length 2 to only match unary, #2109
695692
notj = TRUE

R/fdroplevels.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ fdroplevels = function(x, exclude = if (anyNA(levels(x))) NULL else NA, ...) {
88
ans
99
}
1010

11-
droplevels.data.table = function(x, except=NULL, exclude, in.place=NULL, ...){
12-
if (!is.null(in.place)) stopf("droplevels() with in.place=TRUE is deprecated. Use setdroplevels() instead.")
11+
droplevels.data.table = function(x, except=NULL, exclude, ...){
1312
x = copy(x)
1413
if (missing(exclude)) exclude = NULL
1514
setdroplevels(x, except, exclude)[]

R/fread.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ showProgress=getOption("datatable.showProgress",interactive()), data.table=getOp
77
nThread=getDTthreads(verbose), logical01=getOption("datatable.logical01",FALSE),
88
logicalYN=getOption("datatable.logicalYN", FALSE),
99
keepLeadingZeros=getOption("datatable.keepLeadingZeros",FALSE),
10-
yaml=FALSE, autostart=NULL, tmpdir=tempdir(), tz="UTC")
10+
yaml=FALSE, tmpdir=tempdir(), tz="UTC")
1111
{
1212
if (missing(input)+is.null(file)+is.null(text)+is.null(cmd) < 3L) stopf("Used more than one of the arguments input=, file=, text= and cmd=.")
1313
input_has_vars = length(all.vars(substitute(input)))>0L # see news for v1.11.6
@@ -124,7 +124,6 @@ yaml=FALSE, autostart=NULL, tmpdir=tempdir(), tz="UTC")
124124

125125
input = file
126126
}
127-
if (!is.null(autostart)) stopf("'autostart' is deprecated. Consider skip='string' or skip=n. This argument will be removed in the next release.");
128127
if (is.logical(colClasses)) {
129128
if (!allNA(colClasses)) stopf("colClasses is type 'logical' which is ok if all NA but it has some TRUE or FALSE values in it which is not allowed. Please consider the drop= or select= argument instead. See ?fread.")
130129
colClasses = NULL

R/fwrite.R

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ fwrite = function(x, file="", append=FALSE, quote="auto",
33
sep2=c("","|",""), eol=if (.Platform$OS.type=="windows") "\r\n" else "\n",
44
na="", dec=".", row.names=FALSE, col.names=TRUE,
55
qmethod=c("double","escape"),
6-
logical01=getOption("datatable.logical01", FALSE), # due to change to TRUE; see NEWS
7-
logicalAsInt=NULL,
6+
logical01=getOption("datatable.logical01", FALSE),
87
scipen=getOption('scipen', 0L),
98
dateTimeAs = c("ISO","squash","epoch","write.csv"),
109
buffMB=8L, nThread=getDTthreads(verbose),
@@ -23,9 +22,6 @@ fwrite = function(x, file="", append=FALSE, quote="auto",
2322
compress = match.arg(compress)
2423
dateTimeAs = match.arg(dateTimeAs)
2524
dateTimeAs = chmatch(dateTimeAs, c("ISO", "squash", "epoch", "write.csv")) - 1L
26-
if (!is.null(logicalAsInt)) {
27-
stopf("logicalAsInt has been renamed logical01 for consistency with fread.")
28-
}
2925
scipen = if (is.numeric(scipen)) as.integer(scipen) else 0L
3026
buffMB = as.integer(buffMB)
3127
nThread = as.integer(nThread)

R/onLoad.R

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
11
# nocov start
22

3-
.pkg.store = new.env()
4-
.pkg.store$.unsafe.done = FALSE
53
.unsafe.opt = function() {
6-
if (.pkg.store$.unsafe.done) return(invisible())
7-
val = getOption("datatable.nomatch")
8-
if (is.null(val)) return(invisible()) # not defined (it hasn't been defined in .onLoad since v1.12.4)
9-
warningf("Option 'datatable.nomatch' is defined but is now ignored. Please see note 11 in v1.12.4 NEWS (Oct 2019), and note 14 in v1.14.2.")
10-
# leave this as warning for a long time
11-
.pkg.store$.unsafe.done = TRUE
12-
invisible()
4+
if (!is.null(getOption("datatable.nomatch")))
5+
stopf("Option 'datatable.nomatch' is defined but is now ignored. Please see note 11 in v1.12.4 NEWS (Oct 2019), and note 14 in v1.14.2.")
136
}
147

158
.Last.updated = vector("integer", 1L) # exported variable; number of rows updated by the last := or set(), #1885

inst/tests/tests.Rraw

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4629,7 +4629,7 @@ test(1241, DT[order(x,-y)], # optimized to forder()
46294629

46304630
DT = data.table(a=1:3, b=4:6)
46314631
myCol = "a"
4632-
test(1242.1, DT[2,myCol:=6L,with=FALSE], error="with=FALSE together with := was deprecated in v1.9.4")
4632+
test(1242.1, DT[2,myCol:=6L,with=FALSE], error="`:=` is only supported under with=TRUE.")
46334633
test(1242.2, DT[2,(myCol):=7L], data.table(a=INT(1,7,3), b=4:6))
46344634

46354635
# consistency of output type of mult, #340
@@ -10933,7 +10933,7 @@ test(1736.03, fwrite(DT, sep2=c("",",","")), error="sep.*,.*sep2.*,.*must all be
1093310933
test(1736.04, fwrite(DT, sep2=c("","||","")), error="nchar.*sep2.*2")
1093410934
test(1736.05, capture.output(fwrite(DT, sep='|', sep2=c("c(",",",")"), logical01=FALSE)), c("A|B|C", "1|c(1,2,3,4,5,6,7,8,9,10)|c(s,t,u,v,w)",
1093510935
"2|c(15,16,17,18)|c(1.2,2.3,3.4,3.14159265358979,-9)", "3|c(7)|c(foo,bar)", "4|c(9,10)|c(TRUE,TRUE,FALSE)"))
10936-
test(1736.06, fwrite(DT, sep='|', sep2=c("{",",","}"), logicalAsInt=TRUE), error="logicalAsInt has been renamed logical01")
10936+
# 1736.06 was of defunct logicalAsInt argument
1093710937
DT = data.table(A=c("foo","ba|r","baz"))
1093810938
test(1736.07, capture.output(fwrite(DT,na="")), c("A","foo","ba|r","baz")) # no list column so no need to quote
1093910939
test(1736.08, capture.output(fwrite(DT)), c("A","foo","ba|r","baz"))
@@ -13178,7 +13178,7 @@ test(1925.10, as.ITime(x), structure(c(12L, 67L), class="ITime"))
1317813178
test(1925.11, as.ITime(x, ms='nearest'), structure(c(12L, 68L), class="ITime"))
1317913179
test(1925.12, as.ITime(x, ms='ceil'), structure(c(13L, 68L), class="ITime"))
1318013180

13181-
test(1936.1, fread("A,B\n1,3\n2,4", autostart=1), error="autostart.*deprecated.*Consider skip")
13181+
# 1936.1 was of defunct argument autostart
1318213182
if (.Platform$OS.type == "unix") test(1936.2, is.data.table(fread("ls .")))
1318313183

1318413184
# add helpful error to %between%
@@ -13930,7 +13930,7 @@ test(1967.42, x[3, rollends = rep(TRUE, 10L)], error = 'rollends must be length
1393013930
test(1967.43, x[ , ..], error = 'symbol .. is invalid')
1393113931
test(1967.44, x[NULL], data.table(NULL))
1393213932
test(1967.45, x[ , NULL], NULL)
13933-
test(1967.46, x[ , 'b' := 6:10, with=FALSE], error='with=FALSE together with :=')
13933+
test(1967.46, x[ , 'b' := 6:10, with=FALSE], error='`:=` is only supported under with=TRUE.')
1393413934
x[, b := 6:10]
1393513935
test(1967.47, x[ , -1L, with = FALSE], data.table(b = 6:10))
1393613936
test(1967.48, x[ , b, .SDcols = 'a'], 6:10,
@@ -17788,7 +17788,7 @@ if (base::getRversion() >= "3.4.0") {
1778817788
}
1778917789
test(2214.06, droplevels(DT)[["a"]], droplevels(DT[1:5,a]))
1779017790
test(2214.07, droplevels(DT, 1)[["a"]], x[1:5])
17791-
test(2214.08, droplevels(DT, in.place=TRUE), error="droplevels() with in.place=TRUE is deprecated.")
17791+
# 2214.08 was of defunct in.place argument
1779217792
# support ordered factors in fdroplevels
1779317793
o = factor(letters[1:10], ordered=TRUE)
1779417794
test(2214.09, fdroplevels(o[1:5]), droplevels(o[1:5]))
@@ -21079,3 +21079,8 @@ setindex(DT, b)
2107921079
# make sure that print(DT) doesn't warn due to the header missing index column types, #6806
2108021080
# can't use output= here because the print() call is outside withCallingHandlers(...)
2108121081
test(2307, { capture.output(print(DT, class = TRUE, show.indices = TRUE)); TRUE })
21082+
21083+
# fread with colClasses and keepLeadingZeros=TRUE #6851
21084+
dt = data.table(date=as.IDate(c(NA, "2014-12-05")))
21085+
test(2308.01, fread("date\nNA\n2014-12-05", keepLeadingZeros=TRUE), dt)
21086+
test(2308.02, fread("date\nNA\n2014-12-05", keepLeadingZeros=FALSE), dt)

man/fdroplevels.Rd

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@
1212
fdroplevels(x, exclude = if (anyNA(levels(x))) NULL else NA, \dots)
1313
setdroplevels(x, except = NULL, exclude = NULL)
1414

15-
\method{droplevels}{data.table}(x, except = NULL, exclude, in.place = NULL, \dots)
15+
\method{droplevels}{data.table}(x, except = NULL, exclude, \dots)
1616
}
1717
\arguments{
1818
\item{x}{ \code{factor} or \code{data.table} where unused levels should be dropped. }
1919
\item{exclude}{ A \code{character} vector of factor levels which are dropped no matter of presented or not. }
2020
\item{except}{ An \code{integer} vector of indices of data.table columns which are not modified by dropping levels. }
21-
\item{in.place}{ Deprecated. Use \code{setdroplevels} for in-place modification. }
2221
\item{\dots}{ further arguments passed to methods }
2322
}
2423

0 commit comments

Comments
 (0)