spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xiao Li (JIRA)" <j...@apache.org>
Subject [jira] [Assigned] (SPARK-20416) Column names inconsistent for UDFs in SQL vs Dataset
Date Thu, 11 May 2017 16:51:04 GMT

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

Xiao Li reassigned SPARK-20416:
-------------------------------

    Assignee: Xiao Li

> Column names inconsistent for UDFs in SQL vs Dataset
> ----------------------------------------------------
>
>                 Key: SPARK-20416
>                 URL: https://issues.apache.org/jira/browse/SPARK-20416
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 2.2.0
>            Reporter: Jacek Laskowski
>            Assignee: Xiao Li
>            Priority: Minor
>             Fix For: 2.3.0
>
>
> As you can see below, the name of the columns in SQL vs Dataset is different.
> {code}
> scala> val timesTwoUDF = spark.udf.register("timesTwo", (x: Int) => x * 2)
> timesTwoUDF: org.apache.spark.sql.expressions.UserDefinedFunction = UserDefinedFunction(<function1>,IntegerType,Some(List(IntegerType)))
> scala> spark.sql("SELECT timesTwo(1)").show
> +---------------+
> |UDF:timesTwo(1)|
> +---------------+
> |              2|
> +---------------+
> scala> spark.range(1, 2).toDF("x").select(timesTwoUDF($"x")).show
> +------+
> |UDF(x)|
> +------+
> |     2|
> +------+
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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


Mime
View raw message