GitHub user OopsOutOfMemory opened a pull request:

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

    [SPARK-8010][SQL]Promote numeric types to string type as implicit 
conversion in HiveTypeCoercion

    1. Given a query
    `select coalesce(null, 1, '1') from dual` will cause exception:
    java.lang.RuntimeException: Could not determine return type of Coalesce for 
IntegerType,StringType
    2. Given a query:
    `select case when true then 1 else '1' end from dual` will cause exception:
    java.lang.RuntimeException: Types in CASE WHEN must be the same or 
coercible to a common type: StringType != IntegerType
    I checked the code, the main cause is the HiveTypeCoercion doesn't do 
implicit convert when there is a IntegerType and StringType.
    
    Numeric types can be promoted to string type
    
    Hive will always do this implicit conversion.

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

    $ git pull https://github.com/OopsOutOfMemory/spark pnts

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

    https://github.com/apache/spark/pull/6551.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 #6551
    
----
commit 2cf11cca403b847cfe0ba8241b8fba4c755fdbc9
Author: unknown <[email protected]>
Date:   2015-06-01T09:01:29Z

    promote numeric to string

----


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