【问题标题】:How spark-shell or Zepellin notebook set HiveContext to SparkSession?spark-shell 或 Zepellin notebook 如何将 HiveContext 设置为 SparkSession?
【发布时间】:2017-05-23 18:24:03
【问题描述】:

有人知道为什么我可以通过 spark-shell 或 zepelling 笔记本访问现有的蜂巢表吗

val df = spark.sql("select * from hive_table") 

但是当我提交一个带有以这种方式创建的火花对象的火花罐时,

     val spark = SparkSession
    .builder()
    .appName("Yet another spark app")
    .config("spark.sql.shuffle.partitions", 18)
    .config("spark.executor.memory", "2g")
    .config("spark.serializer","org.apache.spark.serializer.KryoSerializer")
    .getOrCreate()

我收到了

找不到表或视图

我真正想要的是学习、理解 shell 和 notebook 为我们做什么,以便为 SparkSession 提供配置单元上下文。

【问题讨论】:

  • 你没有打电话给enableHiveSupport()
  • 谢谢你,天哪,这么简单:)

标签: scala apache-spark hive


【解决方案1】:

使用 Hive 时,必须在 Hive 支持下实例化 SparkSession

您需要在会话生成器上调用enableHiveSupport()

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-08-11
    • 1970-01-01
    • 2016-07-11
    • 2017-05-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多