Skip to content

Commit 650fe7a

Browse files
authored
Merge branch 'master' into error-enhance
2 parents d62dc76 + d45546b commit 650fe7a

39 files changed

+221
-110
lines changed

.ci/.lintr.R

Lines changed: 34 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -71,45 +71,39 @@ linters = c(dt_linters, all_linters(
7171
))
7272
rm(dt_linters)
7373

74-
# TODO(lintr#2172): Glob with lintr itself.
75-
exclusions = c(local({
76-
exclusion_for_dir <- function(dir, exclusions) {
77-
files = file.path("..", list.files(dir, pattern = "\\.(R|Rmd|Rraw)$", full.names=TRUE))
78-
stats::setNames(rep(list(exclusions), length(files)), files)
79-
}
80-
c(
81-
exclusion_for_dir("tests", list(
82-
quotes_linter = Inf,
83-
# TODO(michaelchirico): Enforce these and re-activate them one-by-one.
84-
implicit_integer_linter = Inf,
85-
infix_spaces_linter = Inf,
86-
undesirable_function_linter = Inf
87-
)),
88-
exclusion_for_dir(c("vignettes", "vignettes/fr", "vignettes/ru"), list(
89-
# assignment_linter = Inf,
90-
implicit_integer_linter = Inf,
91-
quotes_linter = Inf,
92-
sample_int_linter = Inf
93-
# strings_as_factors_linter = Inf
94-
# system_time_linter = Inf
95-
)),
96-
exclusion_for_dir("inst/tests", list(
97-
library_call_linter = Inf,
98-
numeric_leading_zero_linter = Inf,
99-
undesirable_operator_linter = Inf, # For ':::', possibly we could be more careful to only exclude ':::'.
100-
# TODO(michaelchirico): Enforce these and re-activate them one-by-one.
101-
comparison_negation_linter = Inf,
102-
condition_call_linter = Inf,
103-
duplicate_argument_linter = Inf,
104-
equals_na_linter = Inf,
105-
missing_argument_linter = Inf,
106-
paste_linter = Inf,
107-
rep_len_linter = Inf,
108-
sample_int_linter = Inf,
109-
seq_linter = Inf,
110-
unnecessary_lambda_linter = Inf
111-
))
74+
exclusions = list(
75+
`../tests` = list(
76+
quotes_linter = Inf,
77+
# TODO(michaelchirico): Enforce these and re-activate them one-by-one.
78+
implicit_integer_linter = Inf,
79+
infix_spaces_linter = Inf,
80+
undesirable_function_linter = Inf
81+
),
82+
`../vignettes*` = list(
83+
# assignment_linter = Inf,
84+
implicit_integer_linter = Inf,
85+
quotes_linter = Inf,
86+
sample_int_linter = Inf
87+
# strings_as_factors_linter = Inf
88+
# system_time_linter = Inf
89+
),
90+
`../inst/tests` = list(
91+
library_call_linter = Inf,
92+
numeric_leading_zero_linter = Inf,
93+
undesirable_operator_linter = Inf, # For ':::', possibly we could be more careful to only exclude ':::'.
94+
# TODO(michaelchirico): Enforce these and re-activate them one-by-one.
95+
comparison_negation_linter = Inf,
96+
condition_call_linter = Inf,
97+
duplicate_argument_linter = Inf,
98+
equals_na_linter = Inf,
99+
missing_argument_linter = Inf,
100+
paste_linter = Inf,
101+
rep_len_linter = Inf,
102+
sample_int_linter = Inf,
103+
seq_linter = Inf,
104+
unnecessary_lambda_linter = Inf
105+
),
106+
`../inst/tests/froll.Rraw` = list(
107+
dt_test_literal_linter = Inf # TODO(michaelchirico): Fix these once #5898, #5692, #5682, #5576, #5575, #5441 are merged.
112108
)
113-
}),
114-
list(`../inst/tests/froll.Rraw` = list(dt_test_literal_linter = Inf)) # TODO(michaelchirico): Fix these once #5898, #5692, #5682, #5576, #5575, #5441 are merged.
115109
)

.gitlab-ci.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ mirror-packages:
4444
stage: dependencies
4545
tags:
4646
- saas-linux-medium-amd64
47-
image: registry.gitlab.com/jangorecki/dockerfiles/r-base-minimal
47+
image: registry.gitlab.com/rdatatable/dockerfiles/r-base-minimal
4848
cache:
4949
paths:
5050
- bus/$CI_JOB_NAME/cran
@@ -67,7 +67,7 @@ build:
6767
stage: build
6868
tags:
6969
- saas-linux-medium-amd64
70-
image: registry.gitlab.com/jangorecki/dockerfiles/r-base-gcc
70+
image: registry.gitlab.com/rdatatable/dockerfiles/r-base-gcc
7171
needs: ["mirror-packages"]
7272
before_script:
7373
- *install-deps
@@ -106,7 +106,7 @@ build:
106106
# tests for compilation warnings
107107
test-lin-rel:
108108
<<: *test-lin
109-
image: registry.gitlab.com/jangorecki/dockerfiles/r-data.table
109+
image: registry.gitlab.com/rdatatable/dockerfiles/r-data.table
110110
variables:
111111
_R_CHECK_COMPILATION_FLAGS_KNOWN_: "-Wvla"
112112
_R_CHECK_CRAN_INCOMING_: "FALSE"
@@ -128,7 +128,7 @@ test-lin-rel:
128128
# flags: gcc -O0 -fno-openmp
129129
test-lin-rel-vanilla:
130130
<<: *test-lin
131-
image: registry.gitlab.com/jangorecki/dockerfiles/r-base-gcc
131+
image: registry.gitlab.com/rdatatable/dockerfiles/r-base-gcc
132132
variables:
133133
_R_CHECK_COMPILATION_FLAGS_KNOWN_: "-Wvla"
134134
script:
@@ -141,7 +141,7 @@ test-lin-rel-vanilla:
141141
# extra NOTEs check and build pdf manual thus not from cran-lin template
142142
test-lin-rel-cran:
143143
<<: *test-lin
144-
image: registry.gitlab.com/jangorecki/dockerfiles/r-base
144+
image: registry.gitlab.com/rdatatable/dockerfiles/r-base
145145
variables:
146146
_R_CHECK_CRAN_INCOMING_: "TRUE" ## stricter --as-cran checks should run in dev pipelines continuously (not sure what they are though)
147147
_R_CHECK_CRAN_INCOMING_REMOTE_: "FALSE" ## Other than no URL checking (takes many minutes) or 'Days since last update 0' NOTEs needed, #3284
@@ -161,7 +161,7 @@ test-lin-rel-cran:
161161
# tests for new notes
162162
test-lin-dev-gcc-strict-cran:
163163
<<: *test-lin
164-
image: registry.gitlab.com/jangorecki/dockerfiles/r-devel-gcc-strict
164+
image: registry.gitlab.com/rdatatable/dockerfiles/r-devel-gcc-strict
165165
variables:
166166
_R_CHECK_COMPILATION_FLAGS_KNOWN_: "-Wvla"
167167
_R_CHECK_CRAN_INCOMING_: "TRUE"
@@ -183,7 +183,7 @@ test-lin-dev-gcc-strict-cran:
183183
# tests for new notes
184184
test-lin-dev-clang-cran:
185185
<<: *test-lin
186-
image: registry.gitlab.com/jangorecki/dockerfiles/r-devel-clang
186+
image: registry.gitlab.com/rdatatable/dockerfiles/r-devel-clang
187187
variables:
188188
_R_CHECK_COMPILATION_FLAGS_KNOWN_: "-Wvla"
189189
_R_CHECK_CRAN_INCOMING_: "TRUE"
@@ -203,7 +203,7 @@ test-lin-dev-clang-cran:
203203
# stated dependency on R
204204
test-lin-ancient-cran:
205205
<<: *test-lin
206-
image: registry.gitlab.com/jangorecki/dockerfiles/r-3.3.0
206+
image: registry.gitlab.com/rdatatable/dockerfiles/r-3.3.0
207207
variables:
208208
_R_CHECK_FORCE_SUGGESTS_: "FALSE" # can be removed if all dependencies are available (knitr, xts, etc.)
209209
script:
@@ -306,7 +306,7 @@ test-mac-old:
306306
# generating pkgdown website
307307
integration:
308308
stage: integration
309-
image: registry.gitlab.com/jangorecki/dockerfiles/r-pkgdown
309+
image: registry.gitlab.com/rdatatable/dockerfiles/r-pkgdown
310310
tags:
311311
- saas-linux-medium-amd64
312312
only:

DESCRIPTION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ Authors@R: c(
1515
person("Tyson","Barrett", role=c("aut","cre"), email="[email protected]", comment = c(ORCID="0000-0002-2137-1391")),
1616
person("Matt","Dowle", role="aut", email="[email protected]"),
1717
person("Arun","Srinivasan", role="aut", email="[email protected]"),
18-
person("Jan","Gorecki", role="aut"),
19-
person("Michael","Chirico", role="aut", comment = c(ORCID="0000-0003-0787-087X")),
20-
person("Toby","Hocking", role="aut", comment = c(ORCID="0000-0002-3146-0865")),
18+
person("Jan","Gorecki", role="aut", email="[email protected]"),
19+
person("Michael","Chirico", role="aut", email="[email protected]", comment = c(ORCID="0000-0003-0787-087X")),
20+
person("Toby","Hocking", role="aut", email="[email protected]", comment = c(ORCID="0000-0002-3146-0865")),
2121
person("Benjamin","Schwendinger",role="aut", comment = c(ORCID="0000-0003-3315-8114")),
2222
person("Ivan", "Krylov", role="aut", email="[email protected]", comment = c(ORCID="0000-0002-0172-3812")),
2323
person("Pasha","Stetsenko", role="ctb"),

NEWS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010

1111
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.
1212

13+
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.
14+
15+
## NOTES
16+
17+
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/.
18+
1319
# data.table [v1.17.0](https://github.com/Rdatatable/data.table/milestone/34) (20 Feb 2025)
1420

1521
## POTENTIALLY BREAKING CHANGES

inst/tests/tests.Rraw

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10024,10 +10024,13 @@ if (!haszlib()) {
1002410024
fwrite(DT, file=f3<-tempfile(), compress="gzip") # compress to filename not ending .gz
1002510025
fwrite(DT, file=f4<-tempfile(), compress="gzip", compressLevel=1) # test compressLevel
1002610026
fwrite(DT, file=f5<-tempfile(), compress="gzip", compressLevel=9)
10027+
# col.names=FALSE must not disable gzip header, #6852
10028+
fwrite(DT, file=f6<-tempfile(), compress="gzip", col.names=FALSE)
1002710029
test(1658.441, file.info(f3)$size, file.info(f1)$size)
1002810030
test(1658.442, file.info(f4)$size >= file.info(f1)$size)
1002910031
test(1658.443, file.info(f1)$size >= file.info(f5)$size)
10030-
unlink(c(f1,f2,f3,f4,f5))
10032+
test(1658.444, fread(f6, col.names = c("a", "b")), DT)
10033+
unlink(c(f1,f2,f3,f4,f5,f6))
1003110034
}
1003210035
DT = data.table(a=1:3, b=list(1:4, c(3.14, 100e10), c("foo", "bar", "baz")))
1003310036
test(1658.45, fwrite(DT), output=c("a,b","1,1|2|3|4","2,3.14|1e+12","3,foo|bar|baz"))

src/data.table.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
#if R_VERSION < R_Version(3, 4, 0)
1818
# define SET_GROWABLE_BIT(x) // #3292
1919
#endif
20+
// TODO: remove the `R_SVN_VERSION` check when R 4.5.0 is released (circa Apr. 2025)
21+
#if R_VERSION < R_Version(4, 5, 0) || R_SVN_REVISION < 86702
22+
# define isDataFrame(x) isFrame(x) // #6180
23+
#endif
2024
#include <Rinternals.h>
2125
#define SEXPPTR_RO(x) ((const SEXP *)DATAPTR_RO(x)) // to avoid overhead of looped STRING_ELT and VECTOR_ELT
2226
#include <stdint.h> // for uint64_t rather than unsigned long long
@@ -38,7 +42,12 @@
3842
/* we mean the encoding bits, not CE_NATIVE in a UTF-8 locale */
3943
#define IS_UTF8(x) (getCharCE(x) == CE_UTF8)
4044
#define IS_LATIN(x) (getCharCE(x) == CE_LATIN1)
41-
#define IS_ASCII(x) (LEVELS(x) & 64) // API expected in R >= 4.5
45+
// TODO: remove the `R_SVN_VERSION` check when R 4.5.0 is released (circa Apr. 2025)
46+
#if R_VERSION < R_Version(4, 5, 0) || R_SVN_REVISION < 86789
47+
# define IS_ASCII(x) (LEVELS(x) & 64)
48+
#else
49+
# define IS_ASCII(x) (Rf_charIsASCII(x)) // no CE_ASCII
50+
#endif
4251
#define IS_TRUE(x) (TYPEOF(x)==LGLSXP && LENGTH(x)==1 && LOGICAL(x)[0]==TRUE)
4352
#define IS_FALSE(x) (TYPEOF(x)==LGLSXP && LENGTH(x)==1 && LOGICAL(x)[0]==FALSE)
4453
#define IS_TRUE_OR_FALSE(x) (TYPEOF(x)==LGLSXP && LENGTH(x)==1 && LOGICAL(x)[0]!=NA_LOGICAL)

src/dogroups.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ SEXP dogroups(SEXP dt, SEXP dtcols, SEXP groups, SEXP grpcols, SEXP jiscols, SEX
283283
for (int j=0; j<LENGTH(jval); ++j) {
284284
thiscol = VECTOR_ELT(jval,j);
285285
if (isNull(thiscol)) continue;
286-
if (!isVector(thiscol) || isFrame(thiscol))
286+
if (!isVector(thiscol) || isDataFrame(thiscol))
287287
error(_("Entry %d for group %d in j=list(...) should be atomic vector or list. If you are trying something like j=list(.SD,newcol=mean(colA)) then use := by group instead (much quicker), or cbind or merge afterwards."), j+1, i+1);
288288
if (isArray(thiscol)) {
289289
SEXP dims = PROTECT(getAttrib(thiscol, R_DimSymbol));

src/forder.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,7 +1616,7 @@ void putIndex(SEXP x, SEXP cols, SEXP o) {
16161616

16171617
// isTRUE(getOption("datatable.use.index"))
16181618
bool GetUseIndex(void) {
1619-
SEXP opt = GetOption(install("datatable.use.index"), R_NilValue);
1619+
SEXP opt = GetOption1(install("datatable.use.index"));
16201620
if (!IS_TRUE_OR_FALSE(opt))
16211621
error(_("'datatable.use.index' option must be TRUE or FALSE")); // # nocov
16221622
return LOGICAL(opt)[0];
@@ -1627,7 +1627,7 @@ bool GetAutoIndex(void) {
16271627
// for now temporarily 'forder.auto.index' not 'auto.index' to disabled it by default
16281628
// because it writes attr on .SD which is re-used by all groups leading to incorrect results
16291629
// DT[, .(uN=uniqueN(.SD)), by=A]
1630-
SEXP opt = GetOption(install("datatable.forder.auto.index"), R_NilValue);
1630+
SEXP opt = GetOption1(install("datatable.forder.auto.index"));
16311631
if (isNull(opt))
16321632
return false;
16331633
if (!IS_TRUE_OR_FALSE(opt))

src/fread.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1730,8 +1730,10 @@ int freadMain(freadMainArgs _args) {
17301730
topQuoteRule = quoteRule;
17311731
firstJumpEnd = ch; // to know how many bytes jump 0 is, for nrow estimate later (a less-good estimate when fill=true since line lengths vary more)
17321732
if (verbose) {
1733-
DTPRINT((unsigned)sep<32 ? " sep=%#02x" : " sep='%c'", sep); // # notranslate
1734-
DTPRINT(_(" with %d fields using quote rule %d\n"), topNumFields, quoteRule);
1733+
DTPRINT((unsigned)sep<32
1734+
? _(" sep=%#02x with %d fields using quote rule %d\n")
1735+
: _(" sep='%c' with %d fields using quote rule %d\n"),
1736+
sep, topNumFields, quoteRule);
17351737
}
17361738
}
17371739
} else {
@@ -1780,8 +1782,10 @@ int freadMain(freadMainArgs _args) {
17801782
topSkip = thisRow-thisBlockLines;
17811783
if (topSkip<0) topSkip=0; // inelegant but will do for now to pass single row input such as test 890
17821784
if (verbose) {
1783-
DTPRINT((unsigned)sep<32 ? " sep=%#02x" : " sep='%c'", sep); // # notranslate
1784-
DTPRINT(_(" with %d lines of %d fields using quote rule %d\n"), topNumLines, topNumFields, topQuoteRule);
1785+
DTPRINT((unsigned)sep<32
1786+
? _(" sep=%#02x with %d lines of %d fields using quote rule %d\n")
1787+
: _(" sep='%c' with %d lines of %d fields using quote rule %d\n"),
1788+
sep, topNumLines, topNumFields, topQuoteRule);
17851789
}
17861790
}
17871791
}

src/freadR.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ SEXP freadR(
132132
args.logical01 = LOGICAL(logical01Arg)[0];
133133
args.logicalYN = LOGICAL(logicalYNArg)[0];
134134
{
135-
SEXP tt = PROTECT(GetOption(sym_old_fread_datetime_character, R_NilValue));
135+
SEXP tt = PROTECT(GetOption1(sym_old_fread_datetime_character));
136136
args.oldNoDateTime = oldNoDateTime = isLogical(tt) && LENGTH(tt)==1 && LOGICAL(tt)[0]==TRUE;
137137
UNPROTECT(1);
138138
}

0 commit comments

Comments
 (0)