Assuming an example TSV file format as follows:
columnA|columnB|latitude|longitude
And the columns and dimensions are specified as:
"columns" : [ "columnA",
"columnB",
"latitude",
"longitude"
],
"delimiter":"|",
"dimensionsSpec" : {
"dimensions" : [
"columnA",
"columnB",
"latitude",
"longitude"
],
The documentation gives the following example assuming a JSON label with an array of two values
"spatialDimensions" : [
{
"dimName": "coorindates",
"dims": ["latitude", "longitude"]
}
]
The documentation says dimName is required and is "The name of the spatial dimension. A spatial dimension may be constructed from multiple other dimensions or it may already exist as part of an event. If a spatial dimension already exists, it must be an array of coordinate values."
So the logical JSON structure for multiple other dimensions is this, which does parse the data and start the map reduce tasks
"spatialDimensions" : [
{
"dimName" : "latitude",
"dims" : []
},
{
"dimName" : "longitude",
"dims" : []
},
]
but when processing the data, this throws an java.lang.IllegalArgumentException when inserting into the RTree as shown below. This is where the insert checks that the incoming array of floats (coords) contains the proper number of dimensions, which is specified when the rtree is created.
/** @param coords - the coordinates of the entry
* @param entry - the integer to insert
*/
public void insert(float[] coords, int entry) {
Preconditions.checkArgument(coords.length == numDims);
insertInner(new Point(coords, entry, bitmapFactory));
}
I'm guessing at the proper JSON structure, am I specifying this incorrectly ? It looks like the number of dimensions for the RTREE is mismatching the incoming values in the float array for the RTree index.
2016-08-18T21:54:57,091 INFO [main] org.apache.hadoop.mapred.JobClient - Task Id : attempt_201608160124_0063_r_000007_0, Status : FAILED on node b141-18
java.lang.IllegalArgumentException
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:76)
at com.metamx.collections.spatial.RTree.insert(RTree.java:89)
at io.druid.segment.IndexMerger.makeIndexFiles(IndexMerger.java:974)
at io.druid.segment.IndexMerger.merge(IndexMerger.java:423)
at io.druid.segment.IndexMerger.persist(IndexMerger.java:195)
at io.druid.indexer.IndexGeneratorJob$IndexGeneratorReducer.persist(IndexGeneratorJob.java:501)
at io.druid.indexer.IndexGeneratorJob$IndexGeneratorReducer.reduce(IndexGeneratorJob.java:672)
at io.druid.indexer.IndexGeneratorJob$IndexGeneratorReducer.reduce(IndexGeneratorJob.java:469)
at org.apache.hadoop.mapreduce.Reducer.run(Reducer.java:164)
at org.apache.hadoop.mapred.ReduceTask.runNewReducer(ReduceTask.java:620)
at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:458)
at org.apache.hadoop.mapred.Child$4.run(Child.java:278)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:415)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1595)
at org.apache.hadoop.mapred.Child.main(Child.java:267)