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 2018/01/16 11:23:00 UTC
[jira] [Resolved] (SPARK-22978) Register Vectorized UDFs for SQL
Statement
[ https://issues.apache.org/jira/browse/SPARK-22978?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Hyukjin Kwon resolved SPARK-22978.
----------------------------------
Resolution: Fixed
Fix Version/s: 2.3.0
Issue resolved by pull request 20171
[https://github.com/apache/spark/pull/20171]
> Register Vectorized UDFs for SQL Statement
> ------------------------------------------
>
> Key: SPARK-22978
> URL: https://issues.apache.org/jira/browse/SPARK-22978
> Project: Spark
> Issue Type: Sub-task
> Components: PySpark
> Affects Versions: 2.3.0
> Reporter: Xiao Li
> Assignee: Xiao Li
> Priority: Major
> Fix For: 2.3.0
>
>
> Capable of registering vectorized UDFs and then use it in SQL statement.
> For example,
> {noformat}
> >>> import random
> >>> from pyspark.sql.types import IntegerType
> >>> from pyspark.sql.functions import pandas_udf
> >>> random_pandas_udf = pandas_udf(
> ... lambda x: random.randint(0, 100) + x, IntegerType())
> ... .asNondeterministic() # doctest: +SKIP
> >>> _ = spark.catalog.registerFunction(
> ... "random_pandas_udf", random_pandas_udf, IntegerType()) # doctest: +SKIP
> >>> spark.sql("SELECT random_pandas_udf(2)").collect() # doctest: +SKIP
> [Row(random_pandas_udf(2)=84)]
> {noformat}
--
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