additional bug fixes for hadoop based spatial indexing

This commit is contained in:
fjy 2013-05-21 21:33:06 -07:00
parent aa5280028f
commit 39f55a010c
5 changed files with 14 additions and 3 deletions

View File

@ -356,6 +356,11 @@ public class IncrementalIndex implements Iterable<Row>
return spatialDimensions;
}
public SpatialDimensionRowFormatter getSpatialDimensionRowFormatter()
{
return spatialDimensionRowFormatter;
}
public String getMetricType(String metric)
{
return metricTypes.get(metric);

View File

@ -122,6 +122,10 @@ public class SpatialDimensionRowFormatter
};
for (SpatialDimensionSchema spatialDimension : spatialDimensions) {
if (!row.getDimension(spatialDimension.getDimName()).isEmpty()) {
continue;
}
List<String> spatialDimVals = Lists.newArrayList();
for (String partialSpatialDim : spatialDimension.getDims()) {
@ -131,7 +135,7 @@ public class SpatialDimensionRowFormatter
}
}
if (!spatialDimVals.isEmpty()) {
if (spatialDimVals.size() == spatialDimNames.size()) {
spatialLookup.put(spatialDimension.getDimName(), Arrays.asList(JOINER.join(spatialDimVals)));
finalDims.add(spatialDimension.getDimName());
}

View File

@ -19,6 +19,7 @@
package com.metamx.druid.indexer.data;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.Lists;
import com.metamx.common.parsers.JSONParser;
@ -34,6 +35,7 @@ public class JSONDataSpec implements DataSpec
private final List<String> dimensions;
private final List<SpatialDimensionSchema> spatialDimensions;
@JsonCreator
public JSONDataSpec(
@JsonProperty("dimensions") List<String> dimensions,
@JsonProperty("spatialDimensions") List<SpatialDimensionSchema> spatialDimensions

View File

@ -280,7 +280,7 @@ public class IndexGeneratorJob implements Jobby
for (final Text value : values) {
context.progress();
final InputRow inputRow = parser.parse(value.toString());
final InputRow inputRow = index.getSpatialDimensionRowFormatter().formatRow(parser.parse(value.toString()));
allDimensionNames.addAll(inputRow.getDimensions());
int numRows = index.add(inputRow);

View File

@ -58,7 +58,7 @@ public class SpatialFilter implements Filter
@Override
public boolean hasNext()
{
return dimValueIndexesIter.hasNext() || iter.hasNext();
return dimValueIndexesIter.hasNext() || (iter != null && iter.hasNext());
}
@Override