You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by dongjoon-hyun <gi...@git.apache.org> on 2016/04/20 00:54:44 UTC

[GitHub] spark pull request: [WIP][SPARK-14639] Add `bround` function in Py...

GitHub user dongjoon-hyun opened a pull request:

    https://github.com/apache/spark/pull/12509

    [WIP][SPARK-14639] Add `bround` function in Python/R.

    ## What changes were proposed in this pull request?
    
    This issue aims to expose Scala `bround` function in Python/R API.
    `bround` function is implemented in SPARK-14614 by extending current `round` function.
    We used the following semantics from Hive.
    ```java
    public static double bround(double input, int scale) {
        if (Double.isNaN(input) || Double.isInfinite(input)) {
          return input;
        }
        return BigDecimal.valueOf(input).setScale(scale, RoundingMode.HALF_EVEN).doubleValue();
    }
    ```
    
    After this PR, `pyspark` and `sparkR` also can use `bround` function.
    
    **PySpark**
    ```python
    >>> from pyspark.sql.functions import bround
    >>> sqlContext.createDataFrame([(2.5,)], ['a']).select(bround('a', 0).alias('r')).collect()
    [Row(r=2.0)]
    ```
    
    **SparkR**
    ```r
    > df = createDataFrame(sqlContext, data.frame(x=c(2.5,3.5)))
    > head(collect(select(df, bround(df$x,0))))
      bround(x, 0)
    1            2
    2            4
    ```
    
    ## How was this patch tested?
    
    Pass the Jenkins tests (including new testcases).


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/dongjoon-hyun/spark SPARK-14639

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/12509.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #12509
    
----
commit e63e1faea44bb459711008568d917e94b89a9610
Author: Dongjoon Hyun <do...@apache.org>
Date:   2016-04-19T22:46:06Z

    [SPARK-14639] Add bround function in Python/R.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-14639] Add `bround` function in Python/...

Posted by dongjoon-hyun <gi...@git.apache.org>.
Github user dongjoon-hyun commented on the pull request:

    https://github.com/apache/spark/pull/12509#issuecomment-212179141
  
    Hi, @davies . 
    Could you review this PR? After your comments, I studied and finally learned how to expose function in Python and R.
    
    And, if you don't mind, may I include some minor PR #12329 here too? That PR is so minor and needed to be merged other PR like this.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-14639][PYTHON][R] Add `bround` function...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12509#issuecomment-212220761
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/56298/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-14639][PYTHON][R] Add `bround` function...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12509#issuecomment-212245596
  
    **[Test build #56319 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/56319/consoleFull)** for PR 12509 at commit [`077633f`](https://github.com/apache/spark/commit/077633f9f25ff49b2f83d960c07f15bbe5b57ceb).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [WIP][SPARK-14639] Add `bround` function in Py...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12509#issuecomment-212160904
  
    **[Test build #56283 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/56283/consoleFull)** for PR 12509 at commit [`e63e1fa`](https://github.com/apache/spark/commit/e63e1faea44bb459711008568d917e94b89a9610).
     * This patch **fails R style tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [WIP][SPARK-14639] Add `bround` function in Py...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12509#issuecomment-212170473
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/56286/
    Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-14639][PYTHON][R] Add `bround` function...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12509#issuecomment-212183910
  
    **[Test build #56298 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/56298/consoleFull)** for PR 12509 at commit [`58a0558`](https://github.com/apache/spark/commit/58a0558fd1f3889e04a35a11ca8d59aa53bead41).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [WIP][SPARK-14639] Add `bround` function in Py...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12509#issuecomment-212162664
  
    **[Test build #56286 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/56286/consoleFull)** for PR 12509 at commit [`d5c0b3d`](https://github.com/apache/spark/commit/d5c0b3dd95099e293df385d868e98661d5b91b36).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [WIP][SPARK-14639] Add `bround` function in Py...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12509#issuecomment-212160396
  
    **[Test build #56283 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/56283/consoleFull)** for PR 12509 at commit [`e63e1fa`](https://github.com/apache/spark/commit/e63e1faea44bb459711008568d917e94b89a9610).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-14639][PYTHON][R] Add `bround` function...

Posted by shivaram <gi...@git.apache.org>.
Github user shivaram commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12509#discussion_r60339340
  
    --- Diff: R/pkg/R/functions.R ---
    @@ -1008,6 +1008,24 @@ setMethod("round",
                 column(jc)
               })
     
    +#' bround
    +#'
    +#' Returns the value of the column `e` rounded to `scale` decimal places using HALF_EVEN rounding
    +#' mode if `scale` >= 0 or at integral part when `scale` < 0.
    +#'
    +#' @rdname bround
    +#' @name bround
    +#' @family math_funcs
    +#' @export
    +#' @examples \dontrun{bround(df$c, 0)}
    --- End diff --
    
    Could you give a more detailed example of where it gets rounded down and where it gets rounded up ?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-14639][PYTHON][R] Add `bround` function...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12509#issuecomment-212220751
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [WIP][SPARK-14639] Add `bround` function in Py...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12509#issuecomment-212177776
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [WIP][SPARK-14639] Add `bround` function in Py...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12509#issuecomment-212170452
  
    **[Test build #56286 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/56286/consoleFull)** for PR 12509 at commit [`d5c0b3d`](https://github.com/apache/spark/commit/d5c0b3dd95099e293df385d868e98661d5b91b36).
     * This patch **fails SparkR unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-14639][PYTHON][R] Add `bround` function...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12509#issuecomment-212219546
  
    **[Test build #56298 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/56298/consoleFull)** for PR 12509 at commit [`58a0558`](https://github.com/apache/spark/commit/58a0558fd1f3889e04a35a11ca8d59aa53bead41).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-14639][PYTHON][R] Add `bround` function...

Posted by dongjoon-hyun <gi...@git.apache.org>.
Github user dongjoon-hyun commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12509#discussion_r60333919
  
    --- Diff: R/pkg/R/functions.R ---
    @@ -1008,6 +1008,24 @@ setMethod("round",
                 column(jc)
               })
     
    +#' bround
    +#'
    +#' Returns the value of the column `e` rounded to `scale` decimal places using HALF_EVEN rounding
    +#' mode if `scale` >= 0 or at integral part when `scale` < 0.
    +#'
    +#' @rdname bround
    +#' @name bround
    +#' @family math_funcs
    +#' @export
    +#' @examples \dontrun{bround(df$c, 0)}
    +setMethod("bround",
    +          signature(x = "Column", scale = "numeric"),
    --- End diff --
    
    Oh, thank you for sharing know-how. I didn't know that how to do!
    I will fix right now.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [WIP][SPARK-14639] Add `bround` function in Py...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12509#issuecomment-212170472
  
    Merged build finished. Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-14639][PYTHON][R] Add `bround` function...

Posted by davies <gi...@git.apache.org>.
Github user davies commented on the pull request:

    https://github.com/apache/spark/pull/12509#issuecomment-212247971
  
    LGTM


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [WIP][SPARK-14639] Add `bround` function in Py...

Posted by felixcheung <gi...@git.apache.org>.
Github user felixcheung commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12509#discussion_r60327686
  
    --- Diff: python/pyspark/sql/functions.py ---
    @@ -467,16 +467,29 @@ def randn(seed=None):
     @since(1.5)
     def round(col, scale=0):
         """
    -    Round the value of `e` to `scale` decimal places if `scale` >= 0
    +    Round the given value to `scale` decimal places using HALF_UP rounding mode if `scale` >= 0
         or at integral part when `scale` < 0.
     
    -    >>> sqlContext.createDataFrame([(2.546,)], ['a']).select(round('a', 1).alias('r')).collect()
    -    [Row(r=2.5)]
    +    >>> sqlContext.createDataFrame([(2.5,)], ['a']).select(round('a', 0).alias('r')).collect()
    --- End diff --
    
    is this changing the existing behavior?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [WIP][SPARK-14639] Add `bround` function in Py...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12509#issuecomment-212177777
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/56291/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [WIP][SPARK-14639] Add `bround` function in Py...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12509#issuecomment-212177563
  
    **[Test build #56291 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/56291/consoleFull)** for PR 12509 at commit [`fef1bb2`](https://github.com/apache/spark/commit/fef1bb2b2c127c90b1514e94583be230ed56c3b8).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-14639][PYTHON][R] Add `bround` function...

Posted by dongjoon-hyun <gi...@git.apache.org>.
Github user dongjoon-hyun commented on the pull request:

    https://github.com/apache/spark/pull/12509#issuecomment-212248562
  
    Thank you, @davies !
    Or, may I add the minor PR to here? Last time, I remember that you prefer that way.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-14639][PYTHON][R] Add `bround` function...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/12509


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-14639][PYTHON][R] Add `bround` function...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12509#issuecomment-212264540
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/56319/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [WIP][SPARK-14639] Add `bround` function in Py...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12509#issuecomment-212160906
  
    Merged build finished. Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [WIP][SPARK-14639] Add `bround` function in Py...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12509#issuecomment-212170962
  
    **[Test build #56291 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/56291/consoleFull)** for PR 12509 at commit [`fef1bb2`](https://github.com/apache/spark/commit/fef1bb2b2c127c90b1514e94583be230ed56c3b8).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-14639][PYTHON][R] Add `bround` function...

Posted by felixcheung <gi...@git.apache.org>.
Github user felixcheung commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12509#discussion_r60333723
  
    --- Diff: R/pkg/R/functions.R ---
    @@ -1008,6 +1008,24 @@ setMethod("round",
                 column(jc)
               })
     
    +#' bround
    +#'
    +#' Returns the value of the column `e` rounded to `scale` decimal places using HALF_EVEN rounding
    +#' mode if `scale` >= 0 or at integral part when `scale` < 0.
    +#'
    +#' @rdname bround
    +#' @name bround
    +#' @family math_funcs
    +#' @export
    +#' @examples \dontrun{bround(df$c, 0)}
    +setMethod("bround",
    +          signature(x = "Column", scale = "numeric"),
    --- End diff --
    
    should scale be default to 0 to be consistent with Python?
    to do that, do
    ```
               signature(x = "Column"),
               function(x, scale = 0),
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [WIP][SPARK-14639] Add `bround` function in Py...

Posted by dongjoon-hyun <gi...@git.apache.org>.
Github user dongjoon-hyun commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12509#discussion_r60327886
  
    --- Diff: python/pyspark/sql/functions.py ---
    @@ -467,16 +467,29 @@ def randn(seed=None):
     @since(1.5)
     def round(col, scale=0):
         """
    -    Round the value of `e` to `scale` decimal places if `scale` >= 0
    +    Round the given value to `scale` decimal places using HALF_UP rounding mode if `scale` >= 0
         or at integral part when `scale` < 0.
     
    -    >>> sqlContext.createDataFrame([(2.546,)], ['a']).select(round('a', 1).alias('r')).collect()
    -    [Row(r=2.5)]
    +    >>> sqlContext.createDataFrame([(2.5,)], ['a']).select(round('a', 0).alias('r')).collect()
    --- End diff --
    
    Thank you, @felixcheung !
    I just tried to match the example between `round` and `bround`.
    `round` does not change anything.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [WIP][SPARK-14639] Add `bround` function in Py...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12509#issuecomment-212160908
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/56283/
    Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-14639][PYTHON][R] Add `bround` function...

Posted by dongjoon-hyun <gi...@git.apache.org>.
Github user dongjoon-hyun commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12509#discussion_r60347141
  
    --- Diff: R/pkg/R/functions.R ---
    @@ -1008,6 +1008,24 @@ setMethod("round",
                 column(jc)
               })
     
    +#' bround
    +#'
    +#' Returns the value of the column `e` rounded to `scale` decimal places using HALF_EVEN rounding
    +#' mode if `scale` >= 0 or at integral part when `scale` < 0.
    +#'
    +#' @rdname bround
    +#' @name bround
    +#' @family math_funcs
    +#' @export
    +#' @examples \dontrun{bround(df$c, 0)}
    --- End diff --
    
    Sure. Thank you for review. I'll add more example.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-14639][PYTHON][R] Add `bround` function...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12509#issuecomment-212264135
  
    **[Test build #56319 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/56319/consoleFull)** for PR 12509 at commit [`077633f`](https://github.com/apache/spark/commit/077633f9f25ff49b2f83d960c07f15bbe5b57ceb).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-14639][PYTHON][R] Add `bround` function...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12509#issuecomment-212264536
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-14639][PYTHON][R] Add `bround` function...

Posted by dongjoon-hyun <gi...@git.apache.org>.
Github user dongjoon-hyun commented on the pull request:

    https://github.com/apache/spark/pull/12509#issuecomment-212248772
  
    I mean #12329 . I want to close that one in order to reduce committers' review & merge cost.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-14639][PYTHON][R] Add `bround` function...

Posted by davies <gi...@git.apache.org>.
Github user davies commented on the pull request:

    https://github.com/apache/spark/pull/12509#issuecomment-212265432
  
    Merging this into master, thanks!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org