gpt4 book ai didi

apache-zeppelin - 使用 %sql 时找不到表

转载 作者:行者123 更新时间:2023-12-02 03:16:42 24 4
gpt4 key购买 nike

执行%sql语句时,下面代码抛出如下异常:

Exception - org.apache.spark.sql.AnalysisException: Table not found: businessReviews; line 1 pos 14

代码:

val business_DF = sqlCtx.read.json("/Users/tom/Documents/Spring 2016/Java/Project/YELP/yelp/DS - YELP/yelp_academic_dataset_business.json").select("business_id", "categories", "state", "city", "name", "longitude", "latitude")
import sqlContext.implicits._
business_DF.registerTempTable("businessReviews")

%sql
select * from businessReviews

ZEPPELIN_SPARK_USEHIVECONTEXT set to False in zeppelin-env.sh
export ZEPPELIN_SPARK_USEHIVECONTEXT = false # Use HiveContext instead of SQLContext if set true. true by default.

最佳答案

在这一行的开头添加:

spark = SparkSession.builder.master("yarn").enableHiveSupport().getOrCreate()

对我有用

关于apache-zeppelin - 使用 %sql 时找不到表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36559825/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com