Merge pull request #747 from metamx/ingest-segment-npe-fix

fix NPE
This commit is contained in:
fjy 2014-09-17 09:24:10 -06:00
commit a4777ede94
1 changed files with 7 additions and 2 deletions

View File

@ -255,13 +255,18 @@ public class IngestSegmentFirehoseFactory implements FirehoseFactory<InputRowPar
final Map<String, DimensionSelector> dimSelectors = Maps.newHashMap(); final Map<String, DimensionSelector> dimSelectors = Maps.newHashMap();
for (String dim : dims) { for (String dim : dims) {
final DimensionSelector dimSelector = cursor.makeDimensionSelector(dim); final DimensionSelector dimSelector = cursor.makeDimensionSelector(dim);
dimSelectors.put(dim, dimSelector); // dimSelector is null if the dimension is not present
if (dimSelector != null) {
dimSelectors.put(dim, dimSelector);
}
} }
final Map<String, ObjectColumnSelector> metSelectors = Maps.newHashMap(); final Map<String, ObjectColumnSelector> metSelectors = Maps.newHashMap();
for (String metric : metrics) { for (String metric : metrics) {
final ObjectColumnSelector metricSelector = cursor.makeObjectColumnSelector(metric); final ObjectColumnSelector metricSelector = cursor.makeObjectColumnSelector(metric);
metSelectors.put(metric, metricSelector); if (metricSelector != null) {
metSelectors.put(metric, metricSelector);
}
} }
return Sequences.simple( return Sequences.simple(