GitHub user clockfly opened a pull request:

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

    [SPARK-15632][SQL]Typed Filter should NOT change the Dataset schema

    ## What changes were proposed in this pull request?
    
    This PR makes sure the typed Filter doesn't change the Dataset schema.
    
    **Before the change:**
    
    ```
    scala> val df = spark.range(0,9)
    scala> df.schema
    res12: org.apache.spark.sql.types.StructType = 
StructType(StructField(id,LongType,false))
    scala> val afterFilter = df.filter(_=>true)
    scala> afterFilter.schema   // !!! schema is CHANGED!!! Column name is 
changed from id to value, nullable is changed from false to true.
    res13: org.apache.spark.sql.types.StructType = 
StructType(StructField(value,LongType,true))
    
    ```
    
    SerializeFromObject and DeserializeToObject are inserted to wrap the 
Filter, and these two can possibly change the schema of Dataset.
    
    **After the change:**
    
    ```
    scala> afterFilter.schema   // schema is NOT changed.
    res47: org.apache.spark.sql.types.StructType = 
StructType(StructField(id,LongType,false))
    ```
    
    ## How was this patch tested?
    
    Unit test.


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

    $ git pull https://github.com/clockfly/spark spark-15632

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

    https://github.com/apache/spark/pull/13529.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 #13529
    
----
commit 00a873e6547e5bf910012c11d2d91b0de5635973
Author: Sean Zhong <seanzh...@databricks.com>
Date:   2016-06-03T22:19:32Z

    spark-15632

----


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to