Skip to content

Commit 80a50ea

Browse files
authored
Merge branch 'master' into i64remapfix
2 parents dff3ee0 + 5bbc4d5 commit 80a50ea

File tree

17 files changed

+95
-97
lines changed

17 files changed

+95
-97
lines changed

.ci/atime/tests.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
pval.thresh <- 0.001 # to reduce false positives.
2+
13
# Test case adapted from https://github.com/Rdatatable/data.table/issues/6105#issue-2268691745 which is where the issue was reported.
24
# https://github.com/Rdatatable/data.table/pull/6107 fixed performance across 3 ways to specify a column as Date, and we test each individually.
35
extra.args.6107 <- c(

.ci/linters/c/cocci_linter.R

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
cocci_linter = if (!nzchar(Sys.which("spatch"))) function(...) {} else function(c_obj) {
2-
bad <- FALSE
2+
bad = FALSE
3+
tmp = tempfile(fileext = '.c')
4+
on.exit(unlink(tmp))
5+
writeLines(c_obj$preprocessed, tmp)
36
for (spfile in list.files(".ci/linters/cocci", full.names = TRUE)) {
4-
# Coccinelle parser gets confused sometimes, so ignore stderr and the exit code
5-
out = suppressWarnings(system2(
7+
out = system2(
68
"spatch",
7-
shQuote(c(
8-
"--sp-file", spfile, c_obj$path, "--recursive-includes",
9-
"-I", R.home("include"), "-I", "src"
10-
)),
9+
shQuote(c("--sp-file", spfile, tmp)),
1110
stdout = TRUE, stderr = FALSE
12-
))
11+
)
1312
if (length(out) > 0) {
14-
cat(sprintf("In file '%s', Coccinelle patch '%s' recommends the following changes:\n", c_obj$path, spfile))
13+
cat(sprintf("In file '%s', Coccinelle linter '%s' located the following problems:\n", c_obj$path, spfile))
1514
writeLines(out)
16-
bad <- TRUE
15+
bad = TRUE
16+
}
17+
if (!is.null(status <- attr(out, 'status'))) {
18+
cat(sprintf("While working on file '%s', Coccinelle linter '%s' failed with exit code %d:\n", c_obj$path, spfile, status))
19+
bad = TRUE
1720
}
1821
}
19-
if (bad) stop("Please apply the changes above or fix the linter")
22+
if (bad) stop("Please investigate the problems above.")
2023
}

.ci/linters/cocci/malloc_return_value_cast.cocci

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ expression E;
55
- (T)
66
malloc(E)
77

8+
@calloc_realloc_return_value_cast expression@
9+
type T;
10+
expression E1, E2;
11+
identifier alloc =~ "^(c|re)alloc$";
12+
@@
813
- (T)
9-
calloc(_, E)
10-
11-
- (T)
12-
realloc(_, E)
14+
alloc(E1, E2)

.github/CODE_OF_CONDUCT.md

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,16 @@
1-
As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
1+
The R data.table project adheres to NumFOCUS's Code of Conduct.
22

3-
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality.
3+
# The NumFOCUS Code of Conduct
44

5-
Examples of unacceptable behavior by participants include:
5+
## The Short Version
66

7-
* The use of sexualized language or imagery
8-
* Personal attacks
9-
* Trolling or insulting/derogatory comments
10-
* Public or private harassment
11-
* Publishing other's private information, such as physical or electronic addresses, without explicit permission
12-
* Other unethical or unprofessional conduct
7+
Be kind to others. Do not insult or put down others. Behave professionally. Remember that harassment and sexist, racist, or exclusionary jokes are not appropriate for NumFOCUS.
138

14-
Project members with the Committer role have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
9+
All communication should be appropriate for a professional audience including people of many different backgrounds. Sexual language and imagery is not appropriate.
1510

16-
By adopting this Code of Conduct, project members commit themselves to fairly and consistently apply these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team.
11+
NumFOCUS is dedicated to providing a harassment-free community for everyone, regardless of gender, sexual orientation, gender identity and expression, disability, physical appearance, body size, race, or religion. We do not tolerate harassment of community members in any form.
12+
Thank you for helping make this a welcoming, friendly community for all.
1713

18-
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.
14+
[Code of Conduct Reporting Form](https://numfocus.typeform.com/to/ynjGdT)
1915

20-
21-
## Reporting
22-
23-
Project members with the Committer role or the CRAN Maintainer role are pledged to promptly address any reported issues. Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to any individual with this role.
24-
25-
Those who prefer to report in a way that is independent of the current Committers and Maintainer may instead contact the Community Engagement Coordinator by e-mailing [r.data.table\@gmail.com](mailto:[email protected]). Messages sent to this e-mail address will be visible only to the current Community Engagement Coordinator, a position always held by an individual who is not a Committer or CRAN Maintainer of the package.
26-
27-
The current Committers are Toby Dylan Hocking (@tdhock), Matt Dowle (@mattdowle), Arun Srinivasan (@arunsrinivasan), Jan Gorecki (@jangorecki), Michael Chirico (@MichaelChirico), Benjamin Schwendinger (@ben-schwen), and Ivan Krylov (@aitap).
28-
29-
The current CRAN Maintainer is Tyson Barrett (@tysonstanley).
30-
31-
The current Community Engagement Coordinator is Kelly Bodwin (@kbodwin).
32-
33-
All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. Complaint respondents are obligated to maintain confidentiality with regard to the reporter of an incident.
34-
35-
This Code of Conduct is adapted from the [Contributor Covenant, version 1.3.0](https://www.contributor-covenant.org/version/1/3/0/code-of-conduct/), available at [https://www.contributor-covenant.org/version/1/3/0/](https://www.contributor-covenant.org/version/1/3/0/), and the Swift Code of Conduct.
16+
For the full version of the Code of Conduct, please visit: [https://numfocus.org/code-of-conduct](https://numfocus.org/code-of-conduct).

.github/workflows/performance-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ jobs:
2020
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
2121
repo_token: ${{ secrets.GITHUB_TOKEN }}
2222
steps:
23-
- uses: Anirban166/[email protected].2
23+
- uses: Anirban166/[email protected].3

GOVERNANCE.md

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -108,23 +108,14 @@ Please also make a note in the change log under [`# Governance history`](#govern
108108

109109
# Finances and Funding
110110

111-
There is currently no mechanism for the data.table project to receive funding as an entity.
111+
data.table is a [NumFOCUS](https://numfocus.org/) project. Donations to the data.table can be made at [https://numfocus.org/project/data-table]([https://numfocus.org/donate-to-data-table](https://app.hubspot.com/payments/FFWKWTTvKFdzqH?referrer=PAYMENT_LINK))
112112

113-
Funding support for this project therefore may come in two forms:
113+
*NumFOCUS is a 501(c)(3) non-profit charity in the United States; as such, donations to NumFOCUS are tax-deductible as allowed by law. As with any donation, you should consult with your personal tax adviser or the IRS about your particular tax situation.*
114114

115-
## Individual external funding
116115

117-
Any individual developer or community member of data.table may apply for and receive funding for their work on the project. Individuals or groups seeking funding support are strongly encouraged to consult directly with the data.table Project Members (by initiating an Issue on GitHub) to ensure funds are used meaningfully. Formally, however, decisions about use of funds are governed by the individual grantee(s) and their contract with the funding agency.
116+
## Decision-making for funding use
118117

119-
There is no guarantee that funded work will be incorporated into the data.table package; any contributions, whether funded or unfunded, are subject to the same review process as outlined above.
120-
121-
## Direct donations
122-
123-
Direct donations to the project may be made via GitHub Sponsorships, which allow individuals to fund a specific developer. If the current CRAN Maintainer offers a personal sponsorship option, donations may be made to them to support the project in general.
124-
125-
## Decision-making for future opportunities
126-
127-
We here outline a procedure for disbursing funds, should this project in the future become a directly fundable entity (e.g. an LLC or a subsidiary of an umbrella LLC).
118+
We here outline a procedure for disbursing funds acquired through direct donations via NumFOCUS or grant-style research funding.
128119

129120
Funds acquired by the data.table project will be disbursed at the discretion of the **Committers**, defined as above. The **CRAN Maintainer** will have authority to make final decisions in the event that no consensus is reached among committers prior to deadlines for use of funds, and will be responsible for disbursement logistics.
130121

@@ -148,6 +139,8 @@ data.table Version line in DESCRIPTION typically has the following meanings
148139

149140
# Governance history
150141

142+
May 2025: update Finance and CoC language for NumFOCUS incorporation.
143+
151144
Feb 2025: add Finances and Funding section, update Code of Conduct section to be a brief summary and reference the broader CoC document.
152145

153146
Jan 2025: clarify that edits to governance should notify all committers, and that role names are proper nouns (i.e., upper-case) throughout.

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,27 @@
1010
[![CRAN usage](https://jangorecki.gitlab.io/rdeps/data.table/CRAN_usage.svg?sanitize=true)](https://gitlab.com/jangorecki/rdeps)
1111
[![BioC usage](https://jangorecki.gitlab.io/rdeps/data.table/BioC_usage.svg?sanitize=true)](https://gitlab.com/jangorecki/rdeps)
1212
[![indirect usage](https://jangorecki.gitlab.io/rdeps/data.table/indirect_usage.svg?sanitize=true)](https://gitlab.com/jangorecki/rdeps)
13+
[![Powered by NumFOCUS](https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A )](http://numfocus.org)
1314
<!-- badges: end -->
1415

1516
`data.table` provides a high-performance version of [base R](https://www.r-project.org/about.html)'s `data.frame` with syntax and feature enhancements for ease of use, convenience and programming speed.
1617

18+
[//]: # (numfocus-fiscal-sponsor-attribution)
19+
20+
The `data.table` project uses a [custom governance agreement](./GOVERNANCE.md)
21+
and is fiscally sponsored by [NumFOCUS](https://numfocus.org/). Consider making
22+
a [tax-deductible donation](https://numfocus.org/donate-to-data-table) to help the project
23+
pay for developer time, professional services, travel, workshops, and a variety of other needs.
24+
25+
<div align="center">
26+
<a href="https://numfocus.org/project/data-table">
27+
<img height="60px"
28+
src="https://raw.githubusercontent.com/numfocus/templates/master/images/numfocus-logo.png"
29+
align="center">
30+
</a>
31+
</div>
32+
<br>
33+
1734
## Why `data.table`?
1835

1936
* concise syntax: fast to type, fast to read

src/data.table.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
#define IS_FALSE(x) (TYPEOF(x)==LGLSXP && LENGTH(x)==1 && LOGICAL(x)[0]==FALSE)
4747
#define IS_TRUE_OR_FALSE(x) (TYPEOF(x)==LGLSXP && LENGTH(x)==1 && LOGICAL(x)[0]!=NA_LOGICAL)
4848

49-
#define SIZEOF(x) __sizes[TYPEOF(x)]
50-
#define TYPEORDER(x) __typeorder[x]
49+
#define RTYPE_SIZEOF(x) r_type_sizes[TYPEOF(x)]
50+
#define RTYPE_ORDER(x) r_type_order[x]
5151

5252
#ifdef MIN
5353
# undef MIN
@@ -120,8 +120,8 @@ extern SEXP sym_as_posixct;
120120
extern double NA_INT64_D;
121121
extern long long NA_INT64_LL;
122122
extern Rcomplex NA_CPLX; // initialized in init.c; see there for comments
123-
extern size_t __sizes[100]; // max appears to be FUNSXP = 99, see Rinternals.h
124-
extern size_t __typeorder[100]; // __ prefix otherwise if we use these names directly, the SIZEOF define ends up using the local one
123+
extern size_t r_type_sizes[100]; // max appears to be FUNSXP = 99, see Rinternals.h
124+
extern size_t r_type_order[100];
125125

126126
long long DtoLL(double x);
127127
double LLtoD(long long x);

src/dogroups.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ SEXP dogroups(SEXP dt, SEXP dtcols, SEXP groups, SEXP grpcols, SEXP jiscols, SEX
101101
copyMostAttrib(VECTOR_ELT(groups, j), VECTOR_ELT(BY,i)); // not names, otherwise test 778 would fail
102102
SET_STRING_ELT(bynames, i, STRING_ELT(getAttrib(groups,R_NamesSymbol), j));
103103
defineVar(install(CHAR(STRING_ELT(bynames,i))), VECTOR_ELT(BY,i), env); // by vars can be used by name in j as well as via .BY
104-
if (SIZEOF(VECTOR_ELT(BY,i))==0)
104+
if (RTYPE_SIZEOF(VECTOR_ELT(BY,i))==0)
105105
internal_error(__func__, "unsupported size-0 type '%s' in column %d of 'by' should have been caught earlier", type2char(TYPEOF(VECTOR_ELT(BY, i))), i+1); // # nocov
106106
SET_TRUELENGTH(VECTOR_ELT(BY,i), -1); // marker for anySpecialStatic(); see its comments
107107
}
@@ -143,7 +143,7 @@ SEXP dogroups(SEXP dt, SEXP dtcols, SEXP groups, SEXP grpcols, SEXP jiscols, SEX
143143

144144
for(int i=0; i<length(SDall); ++i) {
145145
SEXP this = VECTOR_ELT(SDall, i);
146-
if (SIZEOF(this)==0 && TYPEOF(this)!=EXPRSXP)
146+
if (RTYPE_SIZEOF(this)==0 && TYPEOF(this)!=EXPRSXP)
147147
internal_error(__func__, "size-0 type %d in .SD column %d should have been caught earlier", TYPEOF(this), i); // # nocov
148148
if (LENGTH(this) != maxGrpSize)
149149
internal_error(__func__, "SDall %d length = %d != %d", i+1, LENGTH(this), maxGrpSize); // # nocov
@@ -158,7 +158,7 @@ SEXP dogroups(SEXP dt, SEXP dtcols, SEXP groups, SEXP grpcols, SEXP jiscols, SEX
158158
internal_error(__func__, "length(xknames)!=length(xSD)"); // # nocov
159159
SEXP *xknameSyms = (SEXP *)R_alloc(length(xknames), sizeof(*xknameSyms));
160160
for(int i=0; i<length(xSD); ++i) {
161-
if (SIZEOF(VECTOR_ELT(xSD, i))==0)
161+
if (RTYPE_SIZEOF(VECTOR_ELT(xSD, i))==0)
162162
internal_error(__func__, "type %d in .xSD column %d should have been caught by now", TYPEOF(VECTOR_ELT(xSD, i)), i); // # nocov
163163
xknameSyms[i] = install(CHAR(STRING_ELT(xknames, i)));
164164
}
@@ -541,11 +541,11 @@ SEXP growVector(SEXP x, const R_len_t newlen)
541541
return newx;
542542
}
543543
switch (TYPEOF(x)) {
544-
case RAWSXP: memcpy(RAW(newx), RAW_RO(x), len*SIZEOF(x)); break;
545-
case LGLSXP: memcpy(LOGICAL(newx), LOGICAL_RO(x), len*SIZEOF(x)); break;
546-
case INTSXP: memcpy(INTEGER(newx), INTEGER_RO(x), len*SIZEOF(x)); break;
547-
case REALSXP: memcpy(REAL(newx), REAL_RO(x), len*SIZEOF(x)); break;
548-
case CPLXSXP: memcpy(COMPLEX(newx), COMPLEX_RO(x), len*SIZEOF(x)); break;
544+
case RAWSXP: memcpy(RAW(newx), RAW_RO(x), len*RTYPE_SIZEOF(x)); break;
545+
case LGLSXP: memcpy(LOGICAL(newx), LOGICAL_RO(x), len*RTYPE_SIZEOF(x)); break;
546+
case INTSXP: memcpy(INTEGER(newx), INTEGER_RO(x), len*RTYPE_SIZEOF(x)); break;
547+
case REALSXP: memcpy(REAL(newx), REAL_RO(x), len*RTYPE_SIZEOF(x)); break;
548+
case CPLXSXP: memcpy(COMPLEX(newx), COMPLEX_RO(x), len*RTYPE_SIZEOF(x)); break;
549549
case STRSXP : {
550550
const SEXP *xd = SEXPPTR_RO(x);
551551
for (int i=0; i<len; ++i)

src/fmelt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ SEXP getvaluecols(SEXP DT, SEXP dtnames, Rboolean valfactor, Rboolean verbose, s
524524
ithisidx = INTEGER(thisidx);
525525
thislen = length(thisidx);
526526
}
527-
size_t size = SIZEOF(thiscol);
527+
size_t size = RTYPE_SIZEOF(thiscol);
528528
switch (TYPEOF(target)) {
529529
case VECSXP :
530530
if (data->narm) {
@@ -697,7 +697,7 @@ SEXP getidcols(SEXP DT, SEXP dtnames, Rboolean verbose, struct processData *data
697697
for (int i=0; i<data->lids; ++i) {
698698
int counter = 0;
699699
SEXP thiscol = VECTOR_ELT(DT, INTEGER(data->idcols)[i]-1);
700-
size_t size = SIZEOF(thiscol);
700+
size_t size = RTYPE_SIZEOF(thiscol);
701701
SEXP target;
702702
SET_VECTOR_ELT(ansids, i, target=allocVector(TYPEOF(thiscol), data->totlen) );
703703
copyMostAttrib(thiscol, target); // all but names,dim and dimnames. And if so, we want a copy here, not keepattr's SET_ATTRIB.

0 commit comments

Comments
 (0)