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 2019/05/21 04:15:11 UTC

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

     [ https://issues.apache.org/jira/browse/SPARK-15809?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hyukjin Kwon resolved SPARK-15809.
----------------------------------
    Resolution: Incomplete

> 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
>              Labels: bulk-closed
>
> 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
(v7.6.3#76005)

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