forked from D-Net/dnet-hadoop
use mergeFrom method call to add the country(ies) instead of modify the result directly.
This commit is contained in:
parent
c4987dd12a
commit
b46b080ddc
|
@ -135,12 +135,16 @@ public class SparkCountryPropagationJob2 {
|
|||
for (Qualifier country : r.getCountry()) {
|
||||
countries.add(country.getClassid());
|
||||
}
|
||||
|
||||
Result res = new Result();
|
||||
res.setId(r.getId());
|
||||
List<Country> countryList = new ArrayList<>();
|
||||
for (CountrySbs country : potentialNewCountries.get().getCountrySet()) {
|
||||
if (!countries.contains(country.getClassid())) {
|
||||
r.getCountry().add(getCountry(country.getClassid(), country.getClassname()));
|
||||
countryList.add(getCountry(country.getClassid(), country.getClassname()));
|
||||
}
|
||||
}
|
||||
res.setCountry(countryList);
|
||||
r.mergeFrom(res);
|
||||
}
|
||||
return r;
|
||||
}, Encoders.bean(resultClazz));
|
||||
|
|
Loading…
Reference in New Issue