Issue 12404
Occurrences have null dataset key in HBase
12404
Reporter: trobertson
Assignee: omeyn
Type: Bug
Summary: Occurrences have null dataset key in HBase
Priority: Major
Resolution: Duplicate
Status: Closed
Created: 2012-11-24 10:26:46.448
Updated: 2013-12-17 15:16:50.093
Resolved: 2013-02-21 14:15:50.677
Description: A table reader mapper:
{code}
@Override
protected void map(ImmutableBytesWritable key, Result row, Context context) throws IOException, InterruptedException {
OccurrenceWritable o = OccurrenceWritable.newInstance(row);
context.setStatus("Handling occurrence from dataset[" + o.getDatasetKey() + "]");
context.write(o, ONE);
}
{code}
using
{code}
public static OccurrenceWritable newInstance(Result row) {
Double latitude = OccurrenceResultReader.getDouble(row, FieldName.I_LATITUDE);
Double longitude = OccurrenceResultReader.getDouble(row, FieldName.I_LONGITUDE);
Integer issues = OccurrenceResultReader.getInteger(row, FieldName.I_GEOSPATIAL_ISSUE);
Integer kingdomID = OccurrenceResultReader.getInteger(row, FieldName.I_KINGDOM_ID);
Integer phylumID = OccurrenceResultReader.getInteger(row, FieldName.I_PHYLUM_ID);
Integer classID = OccurrenceResultReader.getInteger(row, FieldName.I_CLASS_ID);
Integer orderID = OccurrenceResultReader.getInteger(row, FieldName.I_ORDER_ID);
Integer familyID = OccurrenceResultReader.getInteger(row, FieldName.I_FAMILY_ID);
Integer genusID = OccurrenceResultReader.getInteger(row, FieldName.I_GENUS_ID);
Integer speciesID = OccurrenceResultReader.getInteger(row, FieldName.I_SPECIES_ID);
// taxon != species (it may be a higher taxon, or might be a subspecies)
Integer taxonID = OccurrenceResultReader.getInteger(row, FieldName.I_NUB_ID);
String publishingOrganisationKey = OccurrenceResultReader.getString(row, FieldName.OWNING_ORG_KEY);
String datasetKey = OccurrenceResultReader.getString(row, FieldName.DATASET_KEY);
String countryIsoCode = OccurrenceResultReader.getString(row, FieldName.I_ISO_COUNTRY_CODE);
Integer year = OccurrenceResultReader.getInteger(row, FieldName.I_YEAR);
Integer month = OccurrenceResultReader.getInteger(row, FieldName.I_MONTH);
Integer borAsInt = OccurrenceResultReader.getInteger(row, FieldName.I_BASIS_OF_RECORD);
BasisOfRecord bor = borc.toEnum(borAsInt);
return new OccurrenceWritable(kingdomID, phylumID, classID, orderID, familyID, genusID, speciesID,
taxonID, issues, publishingOrganisationKey, datasetKey, countryIsoCode, latitude, longitude, year, month, bor, 1);
}
{code}
Is reporting a status of "Handling occurrence from dataset[null]" for some records, which cannot be correct.
]]>
Author: omeyn@gbif.org
Comment: duplicate of OCC-192 (occurrences out of sync with registry)
Created: 2013-02-21 14:15:50.702
Updated: 2013-02-21 14:15:50.702