Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing POSIXlt Warning !!! #5574

Closed
englianhu opened this issue Dec 29, 2022 · 0 comments
Closed

Confusing POSIXlt Warning !!! #5574

englianhu opened this issue Dec 29, 2022 · 0 comments

Comments

@englianhu
Copy link

OK so what's happening is that the evaluation environment of j has strptime overwritten locally:

data.table/R/data.table.R

Lines 1151 to 1154 in a8e926a

SDenv$strptime = function(x, ...) {
warning("POSIXlt column type detected and converted to POSIXct. We do not recommend use of POSIXlt at all because it uses 40 bytes to store one date. Use as.POSIXct to avoid this warning.")
as.POSIXct(base::strptime(x, ...))
}

From there, it doesn't discriminate on whether strptime is operating/producing a column. I don't think there's any easy fix to be more selective on this warning, but the message could be more helpful.

Note that AFAIK strptime can always be replaced by an as.POSIXct call (which wraps to as.POSIXlt-->strptime anyway), in which case j will be ignorant to strptime being called "under the hood" (since the call chain will end up at base::as.POSIXct and so base::strptime is used, not SDenv$strptime)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant