You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spark.apache.org by Anton Okolnychyi <an...@gmail.com> on 2017/07/04 09:22:56 UTC

[SQL] Return Type of Round Func

Hi all,

I have a question regarding the round() function, which was developed long
time ago as SPARK-8159. Currently, the return type is exactly as the input
type. That is reasonable, but does not match with Hive. As I understand,
Hive produces either double or decimal as output (see here
<https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF> for
details).

I know that some functions (e.g., ceil and floor) were updated to match the
behavior of Hive (e.g., return types). Shouldn't it be the same here?

Best,
Anton

Re: [SQL] Return Type of Round Func

Posted by Wenchen Fan <cl...@gmail.com>.
Hive compatibility is not a strong requirement for Spark SQL, and for round, SQLServer also returns the same type as input, see https://docs.microsoft.com/en-us/sql/t-sql/functions/round-transact-sql#return-types <https://docs.microsoft.com/en-us/sql/t-sql/functions/round-transact-sql#return-types>


> On 4 Jul 2017, at 5:22 PM, Anton Okolnychyi <an...@gmail.com> wrote:
> 
> Hi all,
> 
> I have a question regarding the round() function, which was developed long time ago as SPARK-8159. Currently, the return type is exactly as the input type. That is reasonable, but does not match with Hive. As I understand, Hive produces either double or decimal as output (see here <https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF> for details). 
> 
> I know that some functions (e.g., ceil and floor) were updated to match the behavior of Hive (e.g., return types). Shouldn't it be the same here?
> 
> Best,
> Anton