From issues-return-183554-archive-asf-public=cust-asf.ponee.io@spark.apache.org Wed Jan 31 08:51:10 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id 4327F180662 for ; Wed, 31 Jan 2018 08:51:10 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 334F6160C55; Wed, 31 Jan 2018 07:51:10 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 7C64C160C25 for ; Wed, 31 Jan 2018 08:51:09 +0100 (CET) Received: (qmail 52507 invoked by uid 500); 31 Jan 2018 07:51:08 -0000 Mailing-List: contact issues-help@spark.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@spark.apache.org Received: (qmail 52498 invoked by uid 99); 31 Jan 2018 07:51:08 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 31 Jan 2018 07:51:08 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id E275B191AA0 for ; Wed, 31 Jan 2018 07:51:06 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -110.311 X-Spam-Level: X-Spam-Status: No, score=-110.311 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id dq_ex20YZjus for ; Wed, 31 Jan 2018 07:51:06 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 09CFB5F296 for ; Wed, 31 Jan 2018 07:51:06 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 8C655E01D8 for ; Wed, 31 Jan 2018 07:51:04 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 6A016240FA for ; Wed, 31 Jan 2018 07:51:01 +0000 (UTC) Date: Wed, 31 Jan 2018 07:51:01 +0000 (UTC) From: "Xiao Li (JIRA)" To: issues@spark.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (SPARK-22939) Support Spark UDF in registerFunction MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/SPARK-22939?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Xiao Li updated SPARK-22939: ---------------------------- Issue Type: Improvement (was: Bug) > Support Spark UDF in registerFunction > ------------------------------------- > > Key: SPARK-22939 > URL: https://issues.apache.org/jira/browse/SPARK-22939 > Project: Spark > Issue Type: Improvement > Components: PySpark, SQL > Affects Versions: 2.3.0 > Reporter: Xiao Li > Assignee: Xiao Li > Priority: Major > Fix For: 2.3.0 > > > {noformat} > import random > from pyspark.sql.functions import udf > from pyspark.sql.types import IntegerType, StringType > random_udf = udf(lambda: int(random.random() * 100), IntegerType()).asNondeterministic() > spark.catalog.registerFunction("random_udf", random_udf, StringType()) > spark.sql("SELECT random_udf()").collect() > {noformat} > We will get the following error. > {noformat} > Py4JError: An error occurred while calling o29.__getnewargs__. Trace: > py4j.Py4JException: Method __getnewargs__([]) does not exist > at py4j.reflection.ReflectionEngine.getMethod(ReflectionEngine.java:318) > at py4j.reflection.ReflectionEngine.getMethod(ReflectionEngine.java:326) > at py4j.Gateway.invoke(Gateway.java:274) > at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132) > at py4j.commands.CallCommand.execute(CallCommand.java:79) > at py4j.GatewayConnection.run(GatewayConnection.java:214) > at java.lang.Thread.run(Thread.java:745) > {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