GitHub user bdrillard opened a pull request:

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

    [SPARK-22739][Catalyst Additional Expression Support for Objects

    ## What changes were proposed in this pull request?
    
    This PR is a working followup to the expression work begun in #20085. It 
provides necessary `Expression` definitions to support custom encoders (see 
this discussion in the 
[Spark-Avro](https://github.com/databricks/spark-avro/pull/217#issuecomment-342856719)
 project).
    
    It adds the following expressions:
    
    * `ObjectCast` - performs explicit casting of an `Expression` result to a 
`DataType`
    * `StaticField` - retrieves a static field against a class that otherwise 
has no accessor method
    * `InstanceOf` - an `Expression` for the Java `instanceof` operation
    
    Modifies `NewInstance` to take a sequence of method-name and arguments 
initialization tuples, which are executed against the newly constructed object 
instance.
    
    Removes `InitializeJavaBean`, as the generalized `NewInstance` subsumes its 
use-case. 
    
    ## How was this patch tested?
    
    Adds unit test for `NewInstance` supporting post-constructor 
initializations. All previous "JavaBean" tests were refactored to use 
`NewInstance`.
    
    Additional examples of working encoders that would use these new 
expressions can be seen in the 
[Spark-Avro](https://github.com/bdrillard/spark-avro/blob/avro_encoder_2-4/src/main/scala/com/databricks/spark/avro/AvroEncoder.scala)
 and 
[Bunsen](https://github.com/bdrillard/bunsen/blob/issue-23/bunsen-core/src/main/scala/com/cerner/bunsen/EncoderBuilder.scala)
 projects.

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

    $ git pull https://github.com/bdrillard/spark SPARK-22739

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

    https://github.com/apache/spark/pull/21348.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 #21348
    
----
commit 1e25a4ededa38796f739fe949b7795f753b5f2aa
Author: ALeksander Eskilson <alek.eskilson@...>
Date:   2018-05-09T19:06:01Z

    [SPARK-22739] adding new expressions

commit f8643e3ea8dcae58e8af739801c4819f6ca40490
Author: ALeksander Eskilson <alek.eskilson@...>
Date:   2018-05-17T00:18:57Z

    [SPARK-22739] adding new expressions

----


---

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

Reply via email to