Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 940A3200B91 for ; Thu, 29 Sep 2016 22:55:22 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 92B52160AC1; Thu, 29 Sep 2016 20:55:22 +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 D4471160AE3 for ; Thu, 29 Sep 2016 22:55:21 +0200 (CEST) Received: (qmail 23171 invoked by uid 500); 29 Sep 2016 20:55:21 -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 23161 invoked by uid 99); 29 Sep 2016 20:55:21 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Sep 2016 20:55:21 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id C1F0A2C2A64 for ; Thu, 29 Sep 2016 20:55:20 +0000 (UTC) Date: Thu, 29 Sep 2016 20:55:20 +0000 (UTC) From: "Saif Addin Ellafi (JIRA)" To: issues@spark.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (SPARK-17735) Cannot call sqlContext inside udf MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 29 Sep 2016 20:55:22 -0000 [ https://issues.apache.org/jira/browse/SPARK-17735?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Saif Addin Ellafi updated SPARK-17735: -------------------------------------- Description: Hello, I know it is a strange use case but I just wanted to append is cache to hive tables and turned out into this def inCacheUdf = org.apache.spark.sql.functions.udf {name: String => sqlContext.isCached(name)} val ts = sqlContext.tables ts.withColumn("foo", inCacheUdf(ts.col("tableName"))).show .. will throw a Null Pointer Exception. I am not sure, since in my program I was getting: A master url must be set in your configuration or NullPointer at getConf as well. Thoughts? was: Hello, I know it is a strange use case but I just wanted to append is cache to hive tables and turned out into this def inCacheUdf = org.apache.spark.sql.functions.udf {name: String => sqlContext.isCached(name)} val ts = sqlContext.tables ts.withColumn("foo", inCacheUdf(ts.col("tableName"))).show .. will throw a Null Pointer Exception. I am not sure, since in my program I was getting: A master url must be set in your configuration or NullPointer a getConf as well. Thoughts? > Cannot call sqlContext inside udf > --------------------------------- > > Key: SPARK-17735 > URL: https://issues.apache.org/jira/browse/SPARK-17735 > Project: Spark > Issue Type: Bug > Components: Spark Core, SQL > Affects Versions: 1.6.0 > Environment: Linux > Reporter: Saif Addin Ellafi > Priority: Minor > > Hello, I know it is a strange use case but I just wanted to append is cache to hive tables and turned out into this > def inCacheUdf = org.apache.spark.sql.functions.udf {name: String => sqlContext.isCached(name)} > val ts = sqlContext.tables > ts.withColumn("foo", inCacheUdf(ts.col("tableName"))).show > .. will throw a Null Pointer Exception. > I am not sure, since in my program I was getting: > A master url must be set in your configuration > or NullPointer at getConf as well. > Thoughts? -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org For additional commands, e-mail: issues-help@spark.apache.org