spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Saif Addin Ellafi (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (SPARK-17735) Cannot call sqlContext inside udf
Date Thu, 29 Sep 2016 20:55:20 GMT

     [ 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


Mime
View raw message