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

'join' causes R to crash on empty-string suffix #2228

Closed
simon-anders opened this issue Nov 4, 2016 · 3 comments
Closed

'join' causes R to crash on empty-string suffix #2228

simon-anders opened this issue Nov 4, 2016 · 3 comments
Assignees
Labels
bug an unexpected problem or unintended behavior
Milestone

Comments

@simon-anders
Copy link
Contributor

simon-anders commented Nov 4, 2016

Two tibbles with identical column names are joined. If one uses an empty string as one of the two suffixes for the column names, left_join runs into an end-less loop, causing R to crash:

library(  dplyr )

tbl1 <- tibble( key = LETTERS[1:10], val = 1:10 )
tbl2 <- tibble( key = LETTERS[1:10], val = 11:20 )

# This here works as expected
left_join( tbl1, tbl2, by="key", suffix = c( ".A", ".B" ) )

# This here crashes R
left_join( tbl1, tbl2, by="key", suffix = c( "", ".B" ) )

I guess the implementation somewhere assumes that a column without suffix is the original one, but not the joined one, and so misses some stop condition.


Session info:

R version 3.3.2 (2016-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.5 LTS

locale:
 [1] LC_CTYPE=fi_FI.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8    
 [5] LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_GB.UTF-8   
 [7] LC_PAPER=en_GB.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] dplyr_0.5.0

loaded via a namespace (and not attached):
[1] magrittr_1.5   R6_2.1.2       assertthat_0.1 tools_3.3.2    DBI_0.4-1     
[6] tibble_1.1     Rcpp_0.12.6   
@krlmlr
Copy link
Member

krlmlr commented Nov 7, 2016

Thanks, confirmed. Would you like to contribute a testthat test?

@krlmlr krlmlr added data frame bug an unexpected problem or unintended behavior labels Nov 7, 2016
@krlmlr krlmlr added bug an unexpected problem or unintended behavior and removed bug an unexpected problem or unintended behavior labels Nov 7, 2016
@krlmlr
Copy link
Member

krlmlr commented Nov 7, 2016

Looks like a duplicate of #2182 and #2007, too.

@simon-anders
Copy link
Contributor Author

Would you like to contribute a testthat test?

Ok, done so. See pull request #2239

@krlmlr krlmlr self-assigned this Feb 10, 2017
@krlmlr krlmlr modified the milestone: data frame 1 Feb 10, 2017
@lock lock bot locked as resolved and limited conversation to collaborators Jun 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants