mirror of https://github.com/apache/druid.git
additional bug fixes for hadoop based spatial indexing
This commit is contained in:
parent
aa5280028f
commit
39f55a010c
|
@ -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);
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue