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);
}
});
請幫助我〜