GitHub user willb opened a pull request:

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

    SPARK-2863: [SQL] Add facilities for function-argument coercion

    This commit adds the `SignedFunction` trait and modifies the `Sqrt` 
expression
    class to use it for coercing its argument to `DoubleType`.
    
    `SignedFunction` represents a fixed-arity function whose arguments should be
    casted to particular types. Expression classes extending SignedFunction
    must provide `formalTypes`, a List of expected types for formal parameters,
    `actualParams`, a list of Expressions corresponding to actual parameters,
    and create, which creates an instance of that expression class from a list
    of expressions corresponding to actuals. The type parameter for
    SignedFunction should be the expression class extending it.
    
    See the Sqrt class for a concrete example.
    
    This trait (or one or several abstract classes extending this trait) could
    be exposed to code outside `sql` in the future.

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

    $ git pull https://github.com/willb/spark spark-2863

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

    https://github.com/apache/spark/pull/2768.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 #2768
    
----
commit 4f9517a2c11d13f439f3ed7ea447a4559f9e9088
Author: William Benton <[email protected]>
Date:   2014-10-11T12:40:10Z

    Adds SignedFunction trait and type coercion rules
    
    SignedFunction represents a fixed-arity function whose arguments should be
    casted to particular types. Expression classes extending SignedFunction
    must provide `formalTypes`, a List of expected types for formal parameters,
    `actualParams`, a list of Expressions corresponding to actual parameters,
    and create, which creates an instance of that expression class from a list
    of expressions corresponding to actuals. The type parameter for
    SignedFunction should be the expression class extending it.
    
    See the Sqrt class for a concrete example.
    
    This trait (or one or several abstract classes extending this trait) could
    be exposed to code outside `sql` in the future.

----


---
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