Skip to content

Commit 50bfdea

Browse files
Anthony Foxelahrvivaz
Anthony Fox
authored andcommitted
GEOMESA-485 Geometries are being written to the attribute index
Filter out geometry descriptors from getSecondaryIndexedAttributes
1 parent 9468875 commit 50bfdea

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

geomesa-core/src/main/scala/org/locationtech/geomesa/core/data/AccumuloDataStore.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ class AccumuloDataStore(val connector: Connector,
337337

338338
// configure splits for each of the attribute names
339339
def configureAttrIdxTable(featureType: SimpleFeatureType, attributeIndexTable: String): Unit = {
340-
val indexedAttrs = SimpleFeatureTypes.getIndexedAttributes(featureType)
340+
val indexedAttrs = SimpleFeatureTypes.getSecondaryIndexedAttributes(featureType)
341341
if (!indexedAttrs.isEmpty) {
342342
val prefix = index.getTableSharingPrefix(featureType)
343343
val prefixFn = AttributeTable.getAttributeIndexRowPrefix(prefix, _: AttributeDescriptor)

geomesa-core/src/main/scala/org/locationtech/geomesa/core/data/AccumuloFeatureWriter.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ abstract class AccumuloFeatureWriter(featureType: SimpleFeatureType,
6969
extends SimpleFeatureWriter
7070
with Logging {
7171

72-
val indexedAttributes = SimpleFeatureTypes.getIndexedAttributes(featureType)
72+
val indexedAttributes = SimpleFeatureTypes.getSecondaryIndexedAttributes(featureType)
7373

7474
val connector = ds.connector
7575

geomesa-utils/src/main/scala/org/locationtech/geomesa/utils/geotools/SimpleFeatureTypes.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,10 @@ object SimpleFeatureTypes {
6464
def encodeType(sft: SimpleFeatureType): String =
6565
sft.getAttributeDescriptors.map { ad => AttributeSpecFactory.fromAttributeDescriptor(sft, ad).toSpec }.mkString(",")
6666

67-
68-
def getIndexedAttributes(sft: SimpleFeatureType): Seq[AttributeDescriptor] =
69-
sft.getAttributeDescriptors.filter(_.getUserData.getOrElse("index", false).asInstanceOf[java.lang.Boolean])
67+
def getSecondaryIndexedAttributes(sft: SimpleFeatureType): Seq[AttributeDescriptor] =
68+
sft.getAttributeDescriptors
69+
.filter(_.getUserData.getOrElse("index", false).asInstanceOf[java.lang.Boolean])
70+
.filterNot(_.isInstanceOf[GeometryDescriptor])
7071

7172
object AttributeSpecFactory {
7273
def fromAttributeDescriptor(sft: SimpleFeatureType, ad: AttributeDescriptor) = ad.getType match {

geomesa-utils/src/test/scala/org/locationtech/geomesa/utils/geotools/SimpleFeatureTypesTest.scala

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,15 @@ class SimpleFeatureTypesTest extends Specification {
9292
sft.getName.getNamespaceURI must be equalTo "foo"
9393
}
9494

95-
"return the indexed attributes" >> {
95+
"return the indexed attributes (not including the default geometry)" >> {
9696
val sft = SimpleFeatureTypes.createType("testing", "id:Integer:index=false,dtg:Date:index=true,*geom:Point:srid=4326:index=true")
97-
val indexed = SimpleFeatureTypes.getIndexedAttributes(sft)
98-
indexed.map(_.getLocalName) must containTheSameElementsAs(List("dtg", "geom"))
97+
val indexed = SimpleFeatureTypes.getSecondaryIndexedAttributes(sft)
98+
indexed.map(_.getLocalName) must containTheSameElementsAs(List("dtg"))
9999
}
100100

101101
"set index=true for a default geometry" >> {
102102
val sft = SimpleFeatureTypes.createType("testing", "id:Integer:index=false,dtg:Date:index=true,*geom:Point:srid=4326:index=false")
103-
val indexed = SimpleFeatureTypes.getIndexedAttributes(sft).map(_.getLocalName)
104-
indexed must contain("geom")
103+
sft.getGeometryDescriptor.getUserData.get("index").asInstanceOf[Boolean] must beTrue
105104
}
106105

107106
"handle list types" >> {

0 commit comments

Comments
 (0)