From issues-return-183220-archive-asf-public=cust-asf.ponee.io@spark.apache.org Sat Jan 27 20:28:06 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 83DFA18065B for ; Sat, 27 Jan 2018 20:28:06 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 677B5160C30; Sat, 27 Jan 2018 19:28:06 +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 AFCEA160C13 for ; Sat, 27 Jan 2018 20:28:05 +0100 (CET) Received: (qmail 6193 invoked by uid 500); 27 Jan 2018 19:28:04 -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 6183 invoked by uid 99); 27 Jan 2018 19:28:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 27 Jan 2018 19:28:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 5EA351A0871 for ; Sat, 27 Jan 2018 19:28:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -101.51 X-Spam-Level: X-Spam-Status: No, score=-101.51 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, URIBL_BLOCKED=0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id I5sZXSqE8qNJ for ; Sat, 27 Jan 2018 19:28:03 +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 586025F470 for ; Sat, 27 Jan 2018 19:28:03 +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 2A37CE00B0 for ; Sat, 27 Jan 2018 19:28:01 +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 AA87621301 for ; Sat, 27 Jan 2018 19:28:00 +0000 (UTC) Date: Sat, 27 Jan 2018 19:28:00 +0000 (UTC) From: "Xiao Li (JIRA)" To: issues@spark.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (SPARK-23233) asNondeterministic in Python UDF not being set when the UDF is called at least once 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-23233?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Xiao Li resolved SPARK-23233. ----------------------------- Resolution: Fixed Assignee: Hyukjin Kwon Fix Version/s: 2.3.0 > asNondeterministic in Python UDF not being set when the UDF is called at least once > ----------------------------------------------------------------------------------- > > Key: SPARK-23233 > URL: https://issues.apache.org/jira/browse/SPARK-23233 > Project: Spark > Issue Type: Bug > Components: PySpark, SQL > Affects Versions: 2.3.0 > Reporter: Hyukjin Kwon > Assignee: Hyukjin Kwon > Priority: Major > Fix For: 2.3.0 > > > With this diff > {code} > diff --git a/python/pyspark/sql/udf.py b/python/pyspark/sql/udf.py > index de96846c5c7..026a78bf547 100644 > --- a/python/pyspark/sql/udf.py > +++ b/python/pyspark/sql/udf.py > @@ -180,6 +180,7 @@ class UserDefinedFunction(object): > wrapper.deterministic = self.deterministic > wrapper.asNondeterministic = functools.wraps( > self.asNondeterministic)(lambda: self.asNondeterministic()._wrapped()) > + wrapper._unwrapped = lambda: self > return wrapper > def asNondeterministic(self): > {code} > {code:java} > >>> from pyspark.sql.functions import udf > >>> f = udf(lambda x: x) > >>> spark.range(1).select(f("id")) > DataFrame[(id): string] > >>> f._unwrapped()._judf_placeholder.udfDeterministic() > True > >>> ndf = f.asNondeterministic() > >>> ndf.deterministic > False > >>> spark.range(1).select(ndf("id")) > DataFrame[(id): string] > >>> ndf._unwrapped()._judf_placeholder.udfDeterministic() > True > {code} > Seems we don't actually update the {{deterministic}} once it's called due to cache in Python side. -- 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