GitHub user gengliangwang opened a pull request:

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

    [SPARK-21848][SQL] Add trait UDFType to identify user-defined functions

    ## What changes were proposed in this pull request?
    
    Add trait UDFType to identify user-defined functions.
    UDF can be expensive. In optimizer we may need to avoid executing UDF 
multiple times.
    E.g.
    ```scala
    table.select(UDF as 'a).select('a, '(a + 1))
    ```
    If UDF is expensive in this case, optimizer should not collapse the project 
to
    ```scala
    table.select(UDF as 'a, (UDF+1) as '(a+1))
    ```
    
    Currently UDF classes like PythonUDF, HiveGenericUDF are not defined in 
catalyst. 
    This PR is to add a new trait to make it easier to identify user-defined 
functions.
    
    
    ## How was this patch tested?
    
    Unit test


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

    $ git pull https://github.com/gengliangwang/spark UDFType

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

    https://github.com/apache/spark/pull/19064.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 #19064
    
----
commit 5f508ab0b1bf91f7a857adabbefea399c8a71005
Author: Wang Gengliang <ltn...@gmail.com>
Date:   2017-08-26T13:15:15Z

    add trait UDFType to identify UDF 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 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