You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Hyukjin Kwon (JIRA)" <ji...@apache.org> on 2017/01/26 07:03:24 UTC

[jira] [Commented] (SPARK-15809) PySpark SQL UDF default returnType

    [ https://issues.apache.org/jira/browse/SPARK-15809?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15839348#comment-15839348 ] 

Hyukjin Kwon commented on SPARK-15809:
--------------------------------------

I don't think it is worth to do this with breaking the API (getting rid of it breaks existing codes for {{(2)}}).
I think in a way it is also reasonable to provide the default type as {{StringType}} for newbies easily to try the udf only with passing the function.

> PySpark SQL UDF default returnType
> ----------------------------------
>
>                 Key: SPARK-15809
>                 URL: https://issues.apache.org/jira/browse/SPARK-15809
>             Project: Spark
>          Issue Type: Improvement
>          Components: PySpark
>            Reporter: Vladimir Feinberg
>            Priority: Minor
>
> The current signature for the pyspark UDF creation function is:
> {code:python}
> pyspark.sql.functions.udf(f, returnType=StringType)
> {code}
> Is there a reason that there's a default parameter for {{returnType}}? Returning a string by default doesn't strike me as so much more a frequent use case than, say, returning an integer to merit the default.
> In fact, it seems the only reason that the default was chosen is that if we *had to choose* a default type, it would be a {{StringType}} because that's what we can implicitly convert everything to.
> But this only seems to do two things to me: (1) cause unintentional, annoying conversions to strings for new users and (2) make call sites less consistent (if people drop the type specification to actually use the default).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org