Skip to content

Commit 9a97622

Browse files
authored
Merge branch 'master' into macroRemoval
2 parents 4d17949 + 05d6797 commit 9a97622

File tree

9 files changed

+41
-7
lines changed

9 files changed

+41
-7
lines changed

DESCRIPTION

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,5 +102,6 @@ Authors@R: c(
102102
person("Aljaž", "Sluga", role="ctb"),
103103
person("Bill", "Evans", role="ctb"),
104104
person("Reino", "Bruner", role="ctb"),
105-
person(comment=c(github="@badasahog"), role="ctb")
105+
person(comment=c(github="@badasahog"), role="ctb"),
106+
person("Vinit", "Thakur", role="ctb")
106107
)

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040

4141
10. On a heavily loaded machine, a `forder` thread could try to perform a zero-length copy from a null pointer, which was de-facto harmless but is against the C standard and was caught by additional CRAN checks, [#7051](https://github.com/Rdatatable/data.table/issues/7051). Thanks to @helske for the report and @aitap for the PR.
4242

43+
11. Out of sample type bumps now respect `integer64=` selection, [#7032](https://github.com/Rdatatable/data.table/pull/7032).
44+
4345
### NOTES
4446

4547
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/.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919

2020
The `data.table` project uses a [custom governance agreement](./GOVERNANCE.md)
2121
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
22+
a [tax-deductible donation](https://numfocus.org/project/data-table) to help the project
2323
pay for developer time, professional services, travel, workshops, and a variety of other needs.
2424

2525
<div align="center">
2626
<a href="https://numfocus.org/project/data-table">
27-
<img height="60px"
27+
<img width="25%"
2828
src="https://raw.githubusercontent.com/numfocus/templates/master/images/numfocus-logo.png"
2929
align="center">
3030
</a>

inst/tests/tests.Rraw

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3070,6 +3070,16 @@ if (test_bit64) test(1017.1, fread(f), copy(DT)[,A:=as.integer64(A)])
30703070
test(1017.2, fread(f, integer64="character"), DT)
30713071
unlink(f)
30723072

3073+
DT = data.table(a=seq(10000), b="100")
3074+
DT[111, b := "1000000000000"]
3075+
f = tempfile()
3076+
fwrite(DT, f)
3077+
3078+
test(1017.3, fread(f, integer64="numeric"), fread(f, colClasses=c("integer", "numeric")))
3079+
test(1017.4, fread(f, integer64="character"), fread(f, colClasses=c("integer", "character")))
3080+
3081+
unlink(f)
3082+
30733083
# ERANGE errno handled, #106 #4165
30743084
test(1018.1, identical(fread("1.46761e-313\n"), data.table(V1=1.46761e-313)))
30753085
test(1018.2, identical(fread("1.46761e+313\n"), data.table(V1=1.46761e+313)))

man/IDateTime.Rd

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ hours. Because \code{ITime} is stored in seconds, you can add it to a
137137
\code{POSIXct} object, but you should not add it to a \code{Date}
138138
object.
139139

140+
For \code{as.ITime}, note that the string \code{"24:00:00"} is parsed as \code{"00:00:00"}.
141+
This is because the conversion uses \code{as.POSIXct}, which treats \code{"24:00:00"} as midnight of the next day.
142+
This differs from ISO 8601 (which allows \code{"24:00:00"} to represent end-of-day), but aligns with POSIX standards.
143+
To represent end-of-day intervals, use \code{"23:59:59"} or arithmetic (e.g., \code{as.ITime("23:59:59") + 1L}).
144+
140145
We also provide S3 methods to convert to and from \code{Date} and \code{POSIXct}.
141146

142147
\code{ITime} is time zone-agnostic. When converting \code{ITime} and
@@ -245,6 +250,12 @@ identical(as.ITime("10:45"), methods::as("10:45", "ITime"))
245250
246251
(t <- as.ITime("10:45:04", format = "\%H:\%M:\%S"))
247252
253+
# "24:00:00" is parsed as "00:00:00"
254+
as.ITime("24:00:00")
255+
256+
# Workaround for end-of-day: add 1 second to "23:59:59"
257+
as.ITime("23:59:59") + 1L
258+
248259
as.POSIXct("2001-01-01") + as.ITime("10:45")
249260
250261
datetime <- seq(as.POSIXct("2001-01-01"), as.POSIXct("2001-01-03"), by = "5 hour")

man/last.Rd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ of \code{xts::first} is deployed. }
1818
\item{\dots}{ Not applicable for \code{data.table} first/last. Any arguments here
1919
are passed through to \code{xts}'s first/last. }
2020
}
21-
\details{
22-
Note: For zero-length vectors, \code{first(x)} and \code{last(x)} mimic \code{head(x, 1)} and \code{tail(x, 1)} by returning an empty vector instead of \code{NA}. However, unlike \code{head()}/\code{tail()} and base R subsetting (e.g., \code{x[1]}), they do not preserve attributes like names.
21+
\note{
22+
For zero-length vectors, \code{first(x)} and \code{last(x)} mimic \code{head(x, 1)} and \code{tail(x, 1)} by returning an empty vector instead of \code{NA}. However, unlike \code{head()}/\code{tail()} and base R subsetting (e.g., \code{x[1]}), they do not preserve attributes like names.
2323
}
2424
\value{
2525
If no other arguments are supplied it depends on the type of \code{x}. The first/last item

src/fread.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2300,7 +2300,7 @@ int freadMain(freadMainArgs _args) {
23002300
nth = imin(nJumps, nth);
23012301

23022302
if (verbose) DTPRINT(_("[11] Read the data\n"));
2303-
while(true){ // we'll return here to reread any columns with out-of-sample type exceptions, or dirty jumps
2303+
for (;;) { // we'll return here to reread any columns with out-of-sample type exceptions, or dirty jumps
23042304
restartTeam = false;
23052305
if (verbose)
23062306
DTPRINT(" jumps=[%d..%d), chunk_size=%zu, total_size=%td\n", jump0, nJumps, chunkBytes, eof-pos); // # notranslate
@@ -2510,7 +2510,12 @@ int freadMain(freadMainArgs _args) {
25102510
// check that the new type is sufficient for the rest of the column (and any other columns also in out-of-sample bump status) to be
25112511
// sure a single re-read will definitely work.
25122512
while (++absType<CT_STRING && disabled_parsers[absType]) {};
2513-
thisType = TOGGLE_BUMP(absType);
2513+
2514+
if(args.readInt64As != CT_INT64 && absType == CT_INT64)
2515+
thisType = TOGGLE_BUMP(args.readInt64As);
2516+
else
2517+
thisType = TOGGLE_BUMP(absType);
2518+
25142519
tch = fieldStart;
25152520
}
25162521

src/fread.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ typedef struct freadMainArgs
167167
// should datetime with no Z or UTZ-offset be read as UTC?
168168
bool noTZasUTC;
169169

170+
// Integer64 remap
171+
colType readInt64As;
172+
170173
char _padding[1];
171174

172175
// Any additional implementation-specific parameters.

src/freadR.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ SEXP freadR(
177177
readInt64As = CT_FLOAT64;
178178
} else STOP(_("Invalid value integer64='%s'. Must be 'integer64', 'character', 'double' or 'numeric'"), tt);
179179

180+
args.readInt64As = readInt64As;
181+
180182
colClassesSxp = colClassesArg;
181183

182184
selectSxp = selectArg;

0 commit comments

Comments
 (0)