Skip to content

selecting non exsisting colum in tbl_df causes segfault in distinct #1245

@ringprince

Description

@ringprince

I am on

  • os x 10.9.5
  • R 3.2.0
  • dplyr 0.4.2

Here is a reproducible segfault:

 library("dplyr")
 foo = data.frame(x = 1:10, y = 1:10)
 foo[, c("z", "x", "y")] %>% distinct  ## all 'fine'
 ## Error in `[.data.frame`(foo, , c("z", "x", "y")) : 
 ##   undefined columns selected

 tbl_df(foo)[, c("z", "x", "y")] %>% distinct

 ##  *** caught segfault ***
 ## address 0x0, cause 'memory not mapped'
 ## 
 ## Traceback:
 ##  1: .Call("dplyr_distinct_impl", PACKAGE = "dplyr", df, vars)
 ##  2: distinct_impl(dist$data, dist$vars)
 ##  3: distinct_.data.frame(.data, .dots = lazyeval::lazy_dots(...))
 ##  4: NextMethod()
 ##  5: is.data.frame(data)
 ##  6: eval(expr, envir, enclos)
 ##  7: eval(assertion, env)
 ##  8: doTryCatch(return(expr), name, parentenv, handler)
 ##  9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
 ## 10: tryCatchList(expr, classes, parentenv, handlers)
 ## 11: tryCatch({    eval(assertion, env)}, assertError = function(e) {    structure(FALSE, msg = e$message)})
 ## 12: see_if(..., env = env)
 ## 13: assert_that(is.data.frame(data))
 ## 14: tbl_df(NextMethod())
 ## 15: distinct_.tbl_df(.data, .dots = lazyeval::lazy_dots(...))
 ## 16: distinct_(.data, .dots = lazyeval::lazy_dots(...))
 ## 17: distinct(.)
 ## 18: function_list[[k]](value)
 ## 19: withVisible(function_list[[k]](value))
 ## 20: freduce(value, `_function_list`)
 ## 21: `_fseq`(`_lhs`)
 ## 22: eval(expr, envir, enclos)
 ## 23: eval(quote(`_fseq`(`_lhs`)), env, env)
 ## 24: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
 ## 25: tbl_df(foo)[, c("z", "x", "y")] %>% distinct
 ## 
 ## 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: 2

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions