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

melt segfault when duplicated column names exist in DT #1055

Closed
ChristK opened this issue Mar 1, 2015 · 3 comments
Closed

melt segfault when duplicated column names exist in DT #1055

ChristK opened this issue Mar 1, 2015 · 3 comments
Assignees
Labels
Milestone

Comments

@ChristK
Copy link

ChristK commented Mar 1, 2015

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 
@arunsrinivasan arunsrinivasan added this to the v1.9.6 milestone Mar 2, 2015
@arunsrinivasan arunsrinivasan self-assigned this Mar 2, 2015
@arunsrinivasan
Copy link
Member

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

@ChristK
Copy link
Author

ChristK commented Mar 2, 2015

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.

@arunsrinivasan
Copy link
Member

Cool! Thanks 👍 .

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

No branches or pull requests

2 participants