GitHub user wangyum opened a pull request:

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

    [SPARK-21117][SQL] Built-in SQL Function Support - WIDTH_BUCKET

    ## What changes were proposed in this pull request?
    
    Add build-in SQL function - `WIDTH_BUCKET`
    
    Ref: 
https://docs.oracle.com/cd/B28359_01/olap.111/b28126/dml_functions_2137.htm#OLADM717
    
    ## How was this patch tested?
    
    unit tests and manual tests.
    
    manual tests(compare `spark-sql` results with `oracle`):
    ```sql
    select width_bucket(5.35, 0.024, 10.06, 5) from dual; -- 3 --
    
    select width_bucket(3.14, 0, 4, 3) from dual;         -- 3 --
    select width_bucket(2, 0, 4, 3) from dual;            -- 2 --
    select width_bucket(-1, 0, 3.2, 4) from dual;         -- 0 -- 
    
    select width_bucket(3.14, 4, 0, 3) from dual;         -- 1 --
    select width_bucket(2, 4, 0, 3) from dual;            -- 2 --
    select width_bucket(-1, 3.2, 0, 4) from dual;         -- 5 --
    ```

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

    $ git pull https://github.com/wangyum/spark SPARK-21117

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

    https://github.com/apache/spark/pull/18323.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 #18323
    
----
commit 20fe5679735380b931fb3eab6841c1da376c1742
Author: Yuming Wang <[email protected]>
Date:   2017-06-16T06:28:18Z

    Built-in SQL Function Support - WIDTH_BUCKET

----


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