[GitHub] spark pull request #14294: [SPARK-16646][SQL] LEAST and GREATEST doesn't acc...

2016-07-28 Thread HyukjinKwon
Github user HyukjinKwon closed the pull request at:

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


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



[GitHub] spark pull request #14294: [SPARK-16646][SQL] LEAST and GREATEST doesn't acc...

2016-07-20 Thread HyukjinKwon
GitHub user HyukjinKwon opened a pull request:

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

[SPARK-16646][SQL] LEAST and GREATEST doesn't accept numeric arguments with 
different data types

## What changes were proposed in this pull request?

This PR makes `LEAST` and `GREATEST` accept other numeric types 
(`Decimal`). This worked fine in `HiveContext` in 1.6 because , for example, 
`1.5` was `DoubleType` in there.

So, this finds a tightest common type from both `IntegerType` and 
`DoubleType` as `DoubleType`, then it works okay.

But currently it seems `1.5` is being treated as `DecimalType` for now. So, 
It casts 1.5 as decimal(2, 1). So, it fails to find a tightest common type from 
both IntegerType and DecimalType(2, 1).

This PR introduces new function `findTightestCommonTypeToDecimal` dealing 
with decimals interacting with each other or with primitive types. This logic 
was borrowed from JSON schema inference.

## How was this patch tested?

Unit tests in `TypeCoercionSuite` and `DataFrameFunctionsSuite`.


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

$ git pull https://github.com/HyukjinKwon/spark SPARK-16646

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

https://github.com/apache/spark/pull/14294.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 #14294


commit 9730afbc2a303b4961474eb8d21b709a2cd7d596
Author: hyukjinkwon 
Date:   2016-07-21T02:05:53Z

LEAST and GREATEST doesn't accept numeric arguments with different data 
types




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