I am trying to stream in spark and insert into hive.
I want to insert joinKey object to hive.and I cam to a point where I have the code like below.
From here How do I insert to Hive.
Joinkey joinkey= new Joinkey();
finalRDDStream.foreachRDD(new VoidFunction<JavaPairRDD<DetailKey, Tuple2<String, String>>>() {
private static final long serialVersionUID = 1L;
@Override
public void call(JavaPairRDD<DetailKey, Tuple2<String, String>> arg0) throws Exception {
arg0.collect().forEach(x -> {
DetailKey key = x._1;
joinkey.setDate(key.getDate().toString());
joinkey.setName(key.getName());
joinkey.setId(key.getId());
joinkey.setCellNo(x._2._1);
joinkey.setUrl(x._2._2);
});
}
});
I am trying something like below to insert to hive..But it doesnt seem to be correct
finalRDDStream.foreachRDD(new Function<JavaPairRDD<Joinkey,Tuple2<String,String>>, Void>() {
@Override
public Void call(JavaPairRDD<Joinkey, Tuple2<String, String>> arg0)throws Exception {
// TODO Auto-generated method stub
retu null;
}
});
