【问题标题】:Spark temporary table is not shown in beelineSpark 临时表未在直线中显示
【发布时间】:2016-02-24 13:40:14
【问题描述】:

我在 AWS EMR 有一个 Spark 集群,并尝试使用 thrift-server 启动以下代码:

...
JavaSparkContext jsc = new JavaSparkContext(SparkContext.getOrCreate());
HiveContext hiveContext = new HiveContext(jsc);
JavaRDD<Person> people = jsc.textFile("people.txt").map(
  new Function<String, Person>() {
    public Person call(String line) throws Exception {
      ...
    }
});
DataFrame schemaPeople = hiveContext.createDataFrame(people, Person.class);
schemaPeople.registerTempTable("people_temp");
schemaPeople.saveAsTable("people");

HiveThriftServer2.startWithContext(hiveContext);
...

我使用以下命令运行此代码: sudo ./sbin/start-thriftserver.sh --jars /home/ec2-user/some.jar --class spark.jobs.thrift.ThriftServerInit

thrift 服务器启动后,我使用直线连接到它: !connect jdbc:hive2://localhost:10001,运行 show tables; 并得到结果:

+--------------+--------------+--+
|  tableName   | isTemporary  |
+--------------+--------------+--+
| people       | false        |
+--------------+--------------+--+

我也希望看到一个临时表people_temp。为什么people_temp 不见了?

【问题讨论】:

    标签: java amazon-web-services jdbc apache-spark amazon-emr


    【解决方案1】:

    在最新的 Spark 1.6.* 上,我发现需要将配置标志显式设置为单个会话以使其与临时表一起使用:spark.sql.hive.thriftServer.singleSession=true 看看迁移指南 http://spark.apache.org/docs/latest/sql-programming-guide.html#upgrading-from-spark-sql-15-to-16 希望这会有所帮助

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-28
      • 2020-05-14
      • 2020-11-17
      • 1970-01-01
      • 2016-02-07
      • 1970-01-01
      相关资源
      最近更新 更多