GitHub user wojtek-szymanski opened a pull request:

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

    [SPARK-19727][SQL] Fix for round function that modifies original column

    ## What changes were proposed in this pull request?
    
    Fix for SQL round function that modifies original column when underlying 
data frame is created from a local product.
    
        import org.apache.spark.sql.functions._
    
        case class NumericRow(value: BigDecimal)
    
        val df = 
spark.createDataFrame(Seq(NumericRow(BigDecimal("1.23456789"))))
    
        df.show()
        +--------------------+
        |               value|
        +--------------------+
        |1.234567890000000000|
        +--------------------+
    
        df.withColumn("value_rounded", round('value)).show()
        +--------------------+-------------+
        |               value|value_rounded|
        +--------------------+-------------+
        |1.000000000000000000|            1|
        +--------------------+-------------+
    
    ## How was this patch tested?
    
    New unit test added to existing suite 
`org.apache.spark.sql.MathFunctionsSuite`

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

    $ git pull https://github.com/wojtek-szymanski/spark SPARK-19727

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

    https://github.com/apache/spark/pull/17075.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 #17075
    
----
commit ea7c2d3d1b8d71bacc905d01ca327f465ca61c86
Author: Wojtek Szymanski <[email protected]>
Date:   2017-02-27T01:42:37Z

    Fix for SQL round function modifying original column

----


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to