GitHub user petermaxlee opened a pull request:

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

    [SPARK-16850][SQL] Improve type checking error message for greatest/least

    ## What changes were proposed in this pull request?
    Greatest/least function does not have the most friendly error message for 
data types. This patch improves the error message to not show the Seq type, and 
use more human readable data types.
    
    Before:
    ```
    org.apache.spark.sql.AnalysisException: cannot resolve 'greatest(CAST(1.0 
AS DECIMAL(2,1)), "1.0")' due to data type mismatch: The expressions should all 
have the same type, got GREATEST (ArrayBuffer(DecimalType(2,1), StringType)).; 
line 1 pos 7
    ```
    
    After:
    ```
    org.apache.spark.sql.AnalysisException: cannot resolve 'greatest(CAST(1.0 
AS DECIMAL(2,1)), "1.0")' due to data type mismatch: The expressions should all 
have the same type, got GREATEST(decimal(2,1), string).; line 1 pos 7
    ```
    
    ## How was this patch tested?
    Manually verified the output and also added unit tests to 
ConditionalExpressionSuite.

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

    $ git pull https://github.com/petermaxlee/spark SPARK-16850

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

    https://github.com/apache/spark/pull/14453.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 #14453
    
----
commit 1043df4223052d4629f5f46a88ca2104bf6edb19
Author: petermaxlee <petermax...@gmail.com>
Date:   2016-08-02T06:16:07Z

    [SPARK-16850][SQL] Improve type checking error message for greatest/least

----


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