簡體   English   中英

Spark臨時表未顯示在直線上

[英]Spark temporary table is not shown in beeline

我在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

節儉服務器啟動后,我用!connect jdbc:hive2://localhost:10001連接到它: !connect jdbc:hive2://localhost:10001 ,運行show tables; 並得到結果:

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

我希望也能看到一個臨時表people_temp 為什么沒有people_temp

在最新的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希望這會有所幫助

竿

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM