2017-06-14 77 views
0

火花版本:2.1.0spark2.1.0將數據插入蜂巢錯誤

我要插入的「DT」字段劃分Datasetinto蜂巢withing,但是失敗了。使用 'INSERTINTO()' 時

,錯誤是: 'spark2.0 INSERTINTO()不能連同partitionBy()中使用'

使用 'saveAsTale()' 的情況下,錯誤是: '將數據保存在Hive serde表ad中。 ad_industry_user_profile_incr尚未支持。請使用insertInto()API作爲替代方案。'

而且,核心代碼如下:

 rowRDD.foreachRDD(new VoidFunction<JavaRDD<Row>>() { 
      @Override 
      public void call(JavaRDD<Row> rowJavaRDD) throws Exception { 
       Dataset<Row> profileDataFrame = hc.createDataFrame(rowJavaRDD, schema).coalesce(1); 
       profileDataFrame.write().partitionBy("dt").mode(SaveMode.Append).insertInto(tableName); 
//    profileDataFrame.write().partitionBy("dt").mode(SaveMode.Append).saveAsTable(tableName); 
      } 
     }); 

請幫助我〜

回答

0

使用profileDataFrame.write()模式(SaveMode.Append).insertInto(表名) 。無.partitionBy(「dt」)