I've been trying to do a check for result dataset in spark of whether it is empty or has data. I did below following things.
dataset.rdd().isEmpty();
2.
try{
dataset.head(1)
}catch(Exception e){
status ="No data";
}
3.
try{
dataset.first();
}catch(Exception e){
status ="No data";
}
4.
dataset.limit(1).count()>0;
All this are taking a lot of time to complete when comparatively huge data is present. I need to get a efficient solution for this.