Internal error when column is type data.table

Open
#4,661 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
r
Domain
data

Research direction

Start by running the minimal R example in the issue and trace the DT[, FOO:=DT2] path into [.data.table. Check how a data.table RHS is handled and where the later DT$FOO[1] internal error originates. Done means the invalid multi-column assignment is rejected earlier with a clear error instead of producing the unsupported column.

Written by the indexing model from the issue text.

Description

bug

Reported on email to me with a .Rdata supplied, thanks to Илья Сайтанов with permission to use name in news item. I created a MRE.

DT = data.table(A=1, B=2)    # being 1-row may be significant
DT
#        A     B
#    <num> <num>
# 1:     1     2
DT2 = data.table(C=3:4)
DT2
#        C
#    <int>
# 1:     3
# 2:     4
DT[, FOO:=DT2]
DT
#        A     B            FOO
#    <num> <num>   <data.table>
# 1:     1     2 <multi-column>
# should be a warning/error before now that a 2-row data.table is now a column of a 1-row data.table
DT$FOO[1]
# Error in `[.data.table`(DT$FOO, 1) : 
#   Internal error: column type 'NULL' not supported by data.table subset. All known types are
#   supported so please report as bug.
# an error is expected, but a better message than this would be good, and earlier. 

I don't think we allow columns to be <multi-column>, so that itself should be prevented by := I'm thinking; i.e. the DT[, FOO:=DT2] should error with "RHS items cannot be type data.table"?

Dominant language
R
Stars
3.9k
Forks
1.1k
Avg merge
14h 4m
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Rdatatable/data.table

All issues in Rdatatable/data.table

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.