-
Notifications
You must be signed in to change notification settings - Fork 985
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
Triggered internal error with an expression in j while grouping #3708
Comments
@MichaelChirico what do you mean by handled? |
This should not be an internal error. Should be caught sooner than it currently is. Expressions should be wrapped into list to be stored as a column. |
…or unpacked in data.table
I've been poking around a bit and this isn't directly related to the grouping: data.table(e = expression(1))[1]
# Error in `[.data.table`(data.table(e = expression(1)), 1) :
# Internal error: column type 'expression' not supported by data.table subset. All known types are supported so please report as bug. The printout with a multi-row expression column is also weird: data.table(e = expression(1, 2), c=c('1', '2'))
# e c
# <expr> <char>
# 1: expression(1, 2) 1
# 2: expression(1, 2) 2 You get the same issues with columns of type language: data.table(e=as.call(list(sum, 1)), c='1')[1]
# Error in `[.data.table`(data.table(e = as.call(list(sum, 1)), c = "1"), :
# Internal error: column type 'language' not supported by data.table subset. All known types are supported so please report as bug.
data.table(e=as.call(list(sum, 1)), c='1')
# e c
# <call> <char>
# 1: .Primitive("sum")(1) 1
# 2: .Primitive("sum")(1) 1 Which seems extra unintuitive to me. data.table(e=as.name('a'), c='1')
# Error in format.default(char.trunc(col), justify = justify, ...) :
# Found no format() method for class "name"
data.table(e=as.name('a'), c='1')[1]
# Error in `[.data.table`(data.table(e = as.name("a"), c = "1"), 1) :
# invalid type/length (symbol/1) in vector allocation Type environment can also get funky: data.table(e=environment())
# Error in dimnames(x) <- dn :
# length of 'dimnames' [1] not equal to array extent I would also generally expect that From what @jangorecki said, and the work in #4196, it seems to me that the default should be to wrap anything that's not atomic (or a data.frame or matrix) in a list column. Maybe with a warning? It makes a few tests redundant. It would also make much of the work in #4196 redundant, as far as I can tell. Or are there other ways to get a data.table with non-atomic columns? It would also close #4040 and #546 as won't fix, I guess. I'll prepare the pull request if people think this is the way to go. |
Breaking things trying to do coverage and hit an "internal" error:
Of course this should stay an error, but handled differently.
The text was updated successfully, but these errors were encountered: