Skip to content

Commit c639091

Browse files
authored
GEOMESA-3556 Update index config tests and examples (#3514)
1 parent 99291c7 commit c639091

File tree

17 files changed

+250
-278
lines changed

17 files changed

+250
-278
lines changed

geomesa-accumulo/geomesa-accumulo-datastore/src/test/scala/org/locationtech/geomesa/accumulo/index/ConfigurableIndexesTest.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,18 @@ class ConfigurableIndexesTest extends Specification with TestWithFeatureType {
5353
foreach(z3Tables)(t => ds.client.tableOperations().exists(t) must beTrue)
5454
}
5555

56+
"support attribute level configuration" >> {
57+
val typeName = this.sft.getTypeName + "_attr"
58+
ds.createSchema(SimpleFeatureTypes.createType(typeName, "name:String,dtg:Date,*geom:Point:srid=4326:index=z3;id.index.enabled=false"))
59+
val sft = ds.getSchema(typeName)
60+
val indices = ds.manager.indices(sft)
61+
indices must haveLength(1)
62+
indices.head.name mustEqual Z3Index.name
63+
val z3Tables = indices.head.getTableNames()
64+
z3Tables must not(beEmpty)
65+
foreach(z3Tables)(t => ds.client.tableOperations().exists(t) must beTrue)
66+
}
67+
5668
"be able to use z3 for spatial queries" >> {
5769
val filter = "BBOX(geom,40,50,50,60)"
5870
val query = new Query(sftName, ECQL.toFilter(filter))

geomesa-accumulo/geomesa-accumulo-datastore/src/test/scala/org/locationtech/geomesa/accumulo/index/S2IndexTest.scala

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import org.junit.runner.RunWith
1616
import org.locationtech.geomesa.accumulo.TestWithFeatureType
1717
import org.locationtech.geomesa.features.ScalaSimpleFeature
1818
import org.locationtech.geomesa.index.conf.QueryHints.{BIN_BATCH_SIZE, BIN_LABEL, BIN_SORT, BIN_TRACK, SAMPLE_BY, SAMPLING}
19+
import org.locationtech.geomesa.index.index.s2.S2Index
1920
import org.locationtech.geomesa.utils.bin.BinaryOutputEncoder
2021
import org.locationtech.geomesa.utils.bin.BinaryOutputEncoder.BIN_ATTRIBUTE_INDEX
2122
import org.locationtech.geomesa.utils.collection.CloseableIterator
@@ -26,7 +27,7 @@ import java.util.Date
2627
@RunWith(classOf[JUnitRunner])
2728
class S2IndexTest extends TestWithFeatureType {
2829

29-
override val spec = "name:String,track:String,dtg:Date,*geom:Point:srid=4326;geomesa.indices.enabled=s2:geom"
30+
override val spec = "name:String,track:String,dtg:Date,*geom:Point:srid=4326:index=s2;id.index.enabled=false"
3031

3132
val features =
3233
(0 until 10).map { i =>
@@ -53,6 +54,12 @@ class S2IndexTest extends TestWithFeatureType {
5354
}
5455

5556
"S2Index" should {
57+
"only create the s2 index" >> {
58+
val indices = ds.manager.indices(sft)
59+
indices must haveLength(1)
60+
indices.head.name mustEqual S2Index.name
61+
}
62+
5663
"return all features for inclusive filter" >> {
5764
val filter = "bbox(geom, 35, 55, 45, 75)" +
5865
" AND dtg between '2010-05-07T00:00:00.000Z' and '2010-05-08T00:00:00.000Z'"

geomesa-accumulo/geomesa-accumulo-datastore/src/test/scala/org/locationtech/geomesa/accumulo/index/S3IndexTest.scala

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import org.locationtech.geomesa.accumulo.TestWithFeatureType
1616
import org.locationtech.geomesa.features.ScalaSimpleFeature
1717
import org.locationtech.geomesa.index.conf.QueryHints.{BIN_BATCH_SIZE, BIN_LABEL, BIN_SORT, BIN_TRACK, SAMPLE_BY, SAMPLING}
1818
import org.locationtech.geomesa.index.conf.QueryProperties
19+
import org.locationtech.geomesa.index.index.s3.S3Index
1920
import org.locationtech.geomesa.utils.bin.BinaryOutputEncoder
2021
import org.locationtech.geomesa.utils.bin.BinaryOutputEncoder.BIN_ATTRIBUTE_INDEX
2122
import org.locationtech.geomesa.utils.collection.CloseableIterator
@@ -26,7 +27,7 @@ import java.util.Date
2627
@RunWith(classOf[JUnitRunner])
2728
class S3IndexTest extends TestWithFeatureType {
2829

29-
override val spec = "name:String,track:String,dtg:Date,*geom:Point:srid=4326;geomesa.indices.enabled=s3:geom:dtg"
30+
override val spec = "name:String,track:String,dtg:Date,*geom:Point:srid=4326:index=s3;id.index.enabled=false"
3031

3132
val features =
3233
(0 until 10).map { i =>
@@ -48,6 +49,12 @@ class S3IndexTest extends TestWithFeatureType {
4849
execute(new Query(sft.getTypeName, ECQL.toFilter(ecql), transforms.orNull: _*))
4950

5051
"S3Index" should {
52+
"only create the s3 index" >> {
53+
val indices = ds.manager.indices(sft)
54+
indices must haveLength(1)
55+
indices.head.name mustEqual S3Index.name
56+
}
57+
5158
"return all features for inclusive filter" >> {
5259
val filter = "bbox(geom, 38, 59, 51, 61)" +
5360
" AND dtg between '2010-05-07T00:00:00.000Z' and '2010-05-08T00:00:00.000Z'"

geomesa-index-api/src/test/scala/org/locationtech/geomesa/index/geotools/GeoMesaDataStoreTest.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class GeoMesaDataStoreTest extends Specification {
116116
}
117117
"block queries which would cause a full table scan" in {
118118
val sft = SimpleFeatureTypes.createType("61b44359ddb84822983587389d6a28a4",
119-
"name:String,age:Int,dtg:Date,*geom:Point:srid=4326;geomesa.indices.enabled='id,z3,attr:name'")
119+
"name:String:index=true,age:Int,dtg:Date,*geom:Point:srid=4326:index=z3")
120120
sft.getUserData.put("geomesa.query.interceptors",
121121
"org.locationtech.geomesa.index.planning.guard.FullTableScanQueryGuard")
122122

@@ -165,7 +165,7 @@ class GeoMesaDataStoreTest extends Specification {
165165
}
166166
"block queries which would cause a full table scan via sys props" in {
167167
val sft = SimpleFeatureTypes.createType("test",
168-
"name:String,age:Int,dtg:Date,*geom:Point:srid=4326;geomesa.indices.enabled='id,z3,attr:name'")
168+
"name:String:index=true,age:Int,dtg:Date,*geom:Point:srid=4326:index=z3")
169169

170170
val ds = new TestGeoMesaDataStore(true)
171171
ds.createSchema(sft)

0 commit comments

Comments
 (0)