Skip to content
Snippets Groups Projects
  • Felix Cheung's avatar
    2ca5aae4
    [SPARK-22281][SPARKR] Handle R method breaking signature changes · 2ca5aae4
    Felix Cheung authored
    ## What changes were proposed in this pull request?
    
    This is to fix the code for the latest R changes in R-devel, when running CRAN check
    ```
    checking for code/documentation mismatches ... WARNING
    Codoc mismatches from documentation object 'attach':
    attach
    Code: function(what, pos = 2L, name = deparse(substitute(what),
    backtick = FALSE), warn.conflicts = TRUE)
    Docs: function(what, pos = 2L, name = deparse(substitute(what)),
    warn.conflicts = TRUE)
    Mismatches in argument default values:
    Name: 'name' Code: deparse(substitute(what), backtick = FALSE) Docs: deparse(substitute(what))
    
    Codoc mismatches from documentation object 'glm':
    glm
    Code: function(formula, family = gaussian, data, weights, subset,
    na.action, start = NULL, etastart, mustart, offset,
    control = list(...), model = TRUE, method = "glm.fit",
    x = FALSE, y = TRUE, singular.ok = TRUE, contrasts =
    NULL, ...)
    Docs: function(formula, family = gaussian, data, weights, subset,
    na.action, start = NULL, etastart, mustart, offset,
    control = list(...), model = TRUE, method = "glm.fit",
    x = FALSE, y = TRUE, contrasts = NULL, ...)
    Argument names in code not in docs:
    singular.ok
    Mismatches in argument names:
    Position: 16 Code: singular.ok Docs: contrasts
    Position: 17 Code: contrasts Docs: ...
    ```
    
    With attach, it's pulling in the function definition from base::attach. We need to disable that but we would still need a function signature for roxygen2 to build with.
    
    With glm it's pulling in the function definition (ie. "usage") from the stats::glm function. Since this is "compiled in" when we build the source package into the .Rd file, when it changes at runtime or in CRAN check it won't match the latest signature. The solution is not to pull in from stats::glm since there isn't much value in doing that (none of the param we actually use, the ones we do use we have explicitly documented them)
    
    Also with attach we are changing to call dynamically.
    
    ## How was this patch tested?
    
    Manually.
    - [x] check documentation output - yes
    - [x] check help `?attach` `?glm` - yes
    - [x] check on other platforms, r-hub, on r-devel etc..
    
    Author: Felix Cheung <felixcheung_m@hotmail.com>
    
    Closes #19557 from felixcheung/rattachglmdocerror.
    2ca5aae4
    History
    [SPARK-22281][SPARKR] Handle R method breaking signature changes
    Felix Cheung authored
    ## What changes were proposed in this pull request?
    
    This is to fix the code for the latest R changes in R-devel, when running CRAN check
    ```
    checking for code/documentation mismatches ... WARNING
    Codoc mismatches from documentation object 'attach':
    attach
    Code: function(what, pos = 2L, name = deparse(substitute(what),
    backtick = FALSE), warn.conflicts = TRUE)
    Docs: function(what, pos = 2L, name = deparse(substitute(what)),
    warn.conflicts = TRUE)
    Mismatches in argument default values:
    Name: 'name' Code: deparse(substitute(what), backtick = FALSE) Docs: deparse(substitute(what))
    
    Codoc mismatches from documentation object 'glm':
    glm
    Code: function(formula, family = gaussian, data, weights, subset,
    na.action, start = NULL, etastart, mustart, offset,
    control = list(...), model = TRUE, method = "glm.fit",
    x = FALSE, y = TRUE, singular.ok = TRUE, contrasts =
    NULL, ...)
    Docs: function(formula, family = gaussian, data, weights, subset,
    na.action, start = NULL, etastart, mustart, offset,
    control = list(...), model = TRUE, method = "glm.fit",
    x = FALSE, y = TRUE, contrasts = NULL, ...)
    Argument names in code not in docs:
    singular.ok
    Mismatches in argument names:
    Position: 16 Code: singular.ok Docs: contrasts
    Position: 17 Code: contrasts Docs: ...
    ```
    
    With attach, it's pulling in the function definition from base::attach. We need to disable that but we would still need a function signature for roxygen2 to build with.
    
    With glm it's pulling in the function definition (ie. "usage") from the stats::glm function. Since this is "compiled in" when we build the source package into the .Rd file, when it changes at runtime or in CRAN check it won't match the latest signature. The solution is not to pull in from stats::glm since there isn't much value in doing that (none of the param we actually use, the ones we do use we have explicitly documented them)
    
    Also with attach we are changing to call dynamically.
    
    ## How was this patch tested?
    
    Manually.
    - [x] check documentation output - yes
    - [x] check help `?attach` `?glm` - yes
    - [x] check on other platforms, r-hub, on r-devel etc..
    
    Author: Felix Cheung <felixcheung_m@hotmail.com>
    
    Closes #19557 from felixcheung/rattachglmdocerror.
run-tests.sh 2.50 KiB