Skip to content

melt segfault when duplicated column names exist in DT #1055

Closed

Description

@ChristK

See minimal example below

set.seed(45)
require(data.table) # latest GitHub version 
DT <- data.table(
  A = sample(1:2, 120, T),
  B = c(1:120), 
  D = sample(1:10, 120, T),
  D = sample(1:10, 120, T))

melt(DT, id=1:2)

#*** caught segfault ***
#address 0x2000000a, cause 'memory not mapped'

#Traceback:
#1: rbindlist(l, use.names, fill, idcol)
 #2: data.table::.rbind.data.table(...)
 #3: rbind(deparse.level, ...)
 #4: rbind(head(x, topn), tail(x, topn))
 #5: print.data.table(list(A = c(2L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L...# I shortened the output manually

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection: 

The segfault doesn't happen with shorter datatables
I hope the above is helpful for debugging

sessionInfo()
#R version 3.1.2 (2014-10-31)
#Platform: x86_64-apple-darwin13.4.0 (64-bit)

#locale:
#[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8

#attached base packages:
#[1] stats     graphics  grDevices utils     datasets  methods   base     

#other attached packages:
#[1] data.table_1.9.5

#loaded via a namespace (and not attached):
#[1] chron_2.3-45 

Activity

  1. added this to the v1.9.6 milestone on Mar 2, 2015
  2. arunsrinivasan commented on Mar 2, 2015

    @arunsrinivasan
    Member

    Nice catch, thanks! Out of curiosity, do you use data.tables with duplicate names, or is it something you were just testing out?

  3. ChristK commented on Mar 2, 2015

    @ChristK
    Author

    Thanks Arun for the fix!
    I occasionally receive files with age groups as columns. It is 5 year age groups but I usually want 10 year groups. So I rename the columns to 10 year age groups (and I intentionally create duplicate column names). Then melt and then aggregate by 10 year age group. It feels quicker than the other way around

    I just noticed it because my scripts stopped working after the update.

  4. arunsrinivasan commented on Mar 2, 2015

    @arunsrinivasan
    Member

    Cool! Thanks 👍 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions