-
Notifications
You must be signed in to change notification settings - Fork 28.4k
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
[SPARK-20490][SPARKR] Add R wrappers for eqNullSafe and ! / not #17783
Conversation
Test build #76226 has finished for PR 17783 at commit
|
R/pkg/R/functions.R
Outdated
#' ## 3 FALSE | ||
#' } | ||
#' @note not since 2.3.0 | ||
setMethod("not", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this conflict with testthat..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is, but testthat::not
is deprecated anyway.
R/pkg/R/column.R
Outdated
#' ##3 FALSE | ||
#' } | ||
#' @note ! since 2.3.0 | ||
setMethod("!", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this not conflict with any existing R operator?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!
is S4 generic. It is not different than &
and |
which we already support. I believe it hasn't been added so far just because it didn't fit into autogenerate template.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have any thoughts about providing an example output in the docs. I see it makes Jenkins unhappy
R/column.R:325:5: style: Commented code should be removed.
but I believe this is an internal requirement, not something enforced by CRAN.
Note: I cannot reproduce this with local env (lintr
1.0). How is it checked on Jenkins?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which lintr? the current release is 0.2.0?
but I don't think we have a pattern for including output in example doc.
I think you could try
#' # (x = y) (x <=> y)
or
#' (x = y) (x <=> y)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://cran.r-project.org/web/packages/lintr/, do we use something else here?
Test build #76235 has finished for PR 17783 at commit
|
Test build #76237 has finished for PR 17783 at commit
|
@@ -67,8 +67,7 @@ operators <- list( | |||
"+" = "plus", "-" = "minus", "*" = "multiply", "/" = "divide", "%%" = "mod", | |||
"==" = "equalTo", ">" = "gt", "<" = "lt", "!=" = "notEqual", "<=" = "leq", ">=" = "geq", | |||
# we can not override `&&` and `||`, so use `&` and `|` instead | |||
"&" = "and", "|" = "or", #, "!" = "unary_$bang" | |||
"^" = "pow" | |||
"&" = "and", "|" = "or", "^" = "pow" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happens with #,
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this PR implements !
I think it is just confusing, don't you? Not to mention that createOperator
didn't work with !
. I can restore it if you believe it serves some purpose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, let me back track... it looks like "!" = "unary_$bang"
has always been commented out. the #,
does that
I agree we don't need to leave that comment here
R/pkg/R/column.R
Outdated
#' @note ! since 2.3.0 | ||
setMethod("!", | ||
signature(x = "Column"), | ||
function(x) not(x)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe this should be single line?
setMethod("!", signature(x = "Column"), function(x) not(x))
|
||
df <- as.DataFrame(data.frame(is_true = c(TRUE, FALSE, NA))) | ||
expect_equal( | ||
collect(select(df, alias(SparkR::not(df$is_true), "is_false"))), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need SparkR::
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially I experienced some shading issues with testthat::not
, but I cannot reproduce this any longer. Removed.
@@ -1965,6 +1975,16 @@ test_that("filter() on a DataFrame", { | |||
|
|||
# Test stats::filter is working | |||
#expect_true(is.ts(filter(1:100, rep(1, 3)))) # nolint | |||
|
|||
# test suites for %<=>% |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you move this before # Test stats::filter is working
block
Interesting, I think we got 0.2 from his github
https://github.com/jimhester/lintr
|
Test build #76279 has finished for PR 17783 at commit
|
Looks like the same package, just GitHub tags / releases are behind the CRAN. OK, let's remove example output for now and leave I wonder if we could actually remove |
Test build #76280 has finished for PR 17783 at commit
|
Test build #76281 has finished for PR 17783 at commit
|
Test build #76282 has finished for PR 17783 at commit
|
Test build #76285 has finished for PR 17783 at commit
|
f83bcbd
to
457b9c2
Compare
Test build #76290 has finished for PR 17783 at commit
|
Test build #76291 has finished for PR 17783 at commit
|
Jenkins retest this please. |
Test build #76295 has finished for PR 17783 at commit
|
is this ready? please remove the |
we could try but the number of methods and examples we have is much? higher than a lot of other packages.... |
Yeah... Maybe it is possible to hack docs generation process instead. Leave
I want to give it some thought first. I am still confused about the way in which CRAN check and |
Sounds good - I didn't look very closely - what's the issue with ! doc
|
In short, depending on how you set
or
(not that we document any other I kind of know how to handle this by writing |
didn't it warn about
|
We use lower case I am pretty sure this is the one I used at the beginning, and it worked form me locally, but failed on Jenkins. I'll double check this but it feels like cargo cult programming. |
Test build #76314 has finished for PR 17783 at commit
|
Huh, seems to work after all. |
I'm surprised |
R/pkg/R/column.R
Outdated
#' head(select(df, !column("x") > 0)) | ||
#' } | ||
#' @note ! since 2.3.0 | ||
#' @seealso \link{not} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't need this since @rdname not
- they both go to the same html page
Test build #76316 has finished for PR 17783 at commit
|
Test build #76329 has finished for PR 17783 at commit
|
merged to master |
Thanks. |
What changes were proposed in this pull request?
%<=>%
(sames aso.a.s.sql.Column.eqNullSafe
,o.a.s.sql.Column.<=>
)!
and functionnot
.How was this patch tested?
Existing unit tests, additional unit tests,
check-cran.sh
.