Skip to content

Commit 7067f36

Browse files
AndrewAnnexjnh5y
authored andcommitted
GEOMESA-481 Remove use of decodeKey in STII and II.
1 parent eb6a1f3 commit 7067f36

File tree

4 files changed

+14
-40
lines changed

4 files changed

+14
-40
lines changed

geomesa-core/src/main/scala/org/locationtech/geomesa/core/index/STIdxStrategy.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ class STIdxStrategy extends Strategy with Logging with IndexFilterHelpers {
178178
featureType: SimpleFeatureType): IteratorSetting = {
179179
val cfg = new IteratorSetting(iteratorPriority_SpatioTemporalIterator,
180180
"within-" + randomPrintableString(5),classOf[IndexIterator])
181-
IndexIterator.setOptions(cfg, schema, filter)
181+
IndexIterator.setOptions(cfg, filter)
182182
// the transform will have already been set in the query hints
183183
val testType = query.getHints.get(TRANSFORM_SCHEMA).asInstanceOf[SimpleFeatureType]
184184
configureFeatureType(cfg, testType)
@@ -196,7 +196,7 @@ class STIdxStrategy extends Strategy with Logging with IndexFilterHelpers {
196196
val cfg = new IteratorSetting(iteratorPriority_SpatioTemporalIterator,
197197
"within-" + randomPrintableString(5),
198198
classOf[SpatioTemporalIntersectingIterator])
199-
SpatioTemporalIntersectingIterator.setOptions(cfg, schema, filter)
199+
SpatioTemporalIntersectingIterator.setOptions(cfg, filter)
200200
configureFeatureType(cfg, featureType)
201201
if (isDensity) cfg.addOption(GEOMESA_ITERATORS_IS_DENSITY_TYPE, "isDensity")
202202
cfg

geomesa-core/src/main/scala/org/locationtech/geomesa/core/index/Strategy.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ trait Strategy {
9494
"sffilter-" + randomPrintableString(5),
9595
classOf[SimpleFeatureFilteringIterator])
9696

97-
cfg.addOption(DEFAULT_SCHEMA_NAME, schema)
9897
configureFeatureEncoding(cfg, featureEncoding)
9998
configureTransforms(query,cfg)
10099
configureFeatureType(cfg, simpleFeatureType)
@@ -153,7 +152,6 @@ trait Strategy {
153152

154153
TemporalDensityIterator.configure(cfg, interval, buckets)
155154

156-
cfg.addOption(DEFAULT_SCHEMA_NAME, schema)
157155
configureFeatureEncoding(cfg, featureEncoding)
158156
configureFeatureType(cfg, featureType)
159157

geomesa-core/src/main/scala/org/locationtech/geomesa/core/iterators/IndexIterator.scala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,6 @@ class IndexIterator extends SpatioTemporalIntersectingIterator with SortedKeyVal
6767

6868
featureBuilder = AvroSimpleFeatureFactory.featureBuilder(featureType)
6969

70-
val schemaEncoding = options.get(DEFAULT_SCHEMA_NAME)
71-
decoder = IndexSchema.getIndexEntryDecoder(schemaEncoding)
72-
7370
if (options.containsKey(DEFAULT_FILTER_PROPERTY_NAME)) {
7471
val filterString = options.get(DEFAULT_FILTER_PROPERTY_NAME)
7572
filter = ECQL.toFilter(filterString)

geomesa-core/src/main/scala/org/locationtech/geomesa/core/iterators/SpatioTemporalIntersectingIterator.scala

Lines changed: 12 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import org.opengis.feature.simple.SimpleFeature
3434
import org.opengis.filter._
3535

3636
import scala.collection.JavaConverters._
37-
import scala.util.Try
3837

3938
case class Attribute(name: Text, value: Text)
4039

@@ -59,7 +58,6 @@ class SpatioTemporalIntersectingIterator
5958

6059
protected var indexSource: SortedKeyValueIterator[Key, Value] = null
6160
protected var dataSource: SortedKeyValueIterator[Key, Value] = null
62-
protected var decoder: IndexEntryDecoder = null
6361
protected var topKey: Key = null
6462
protected var topValue: Value = null
6563
protected var nextKey: Key = null
@@ -70,9 +68,6 @@ class SpatioTemporalIntersectingIterator
7068
protected var testSimpleFeature: SimpleFeature = null
7169
protected var dateAttributeName: Option[String] = None
7270

73-
// Used by aggregators that extend STII
74-
protected var curFeature: SimpleFeature = null
75-
7671
protected var deduplicate: Boolean = false
7772

7873
// each batch-scanner thread maintains its own (imperfect!) list of the
@@ -90,9 +85,6 @@ class SpatioTemporalIntersectingIterator
9085

9186
dateAttributeName = getDtgFieldName(featureType)
9287

93-
val schemaEncoding = options.get(DEFAULT_SCHEMA_NAME)
94-
decoder = IndexSchema.getIndexEntryDecoder(schemaEncoding)
95-
9688
if (options.containsKey(DEFAULT_FILTER_PROPERTY_NAME)) {
9789
val filterString = options.get(DEFAULT_FILTER_PROPERTY_NAME)
9890
filter = ECQL.toFilter(filterString)
@@ -188,12 +180,6 @@ class SpatioTemporalIntersectingIterator
188180
itr.next()
189181
}
190182

191-
/**
192-
* Attempt to decode the given key. This should only succeed in the cases
193-
* where the key corresponds to an index-entry (not a data-entry).
194-
*/
195-
def decodeKey(key:Key): Option[SimpleFeature] = Try(decoder.decode(key)).toOption
196-
197183
/**
198184
* Advances the index-iterator to the next qualifying entry, and then
199185
* updates the data-iterator to match what ID the index-iterator found
@@ -207,23 +193,17 @@ class SpatioTemporalIntersectingIterator
207193
skipDataEntries(indexSource)
208194

209195
while (nextValue == null && indexSource.hasTop && indexSource.getTopKey != null) {
210-
// only consider this index entry if we could fully decode the key
211-
decodeKey(indexSource.getTopKey).map { decodedKey =>
212-
curFeature = decodedKey
213-
// the value contains the full-resolution geometry and time; use them
214-
lazy val decodedValue = IndexEntry.decodeIndexValue(indexSource.getTopValue)
215-
lazy val isSTAcceptable = wrappedSTFilter(decodedValue.geom, decodedValue.dtgMillis)
216-
217-
// see whether this box is acceptable
218-
// (the tests are ordered from fastest to slowest to take advantage of
219-
// short-circuit evaluation)
220-
if (isIdUnique(decodedValue.id) && isSTAcceptable) {
221-
// stash this ID
222-
rememberId(decodedValue.id)
223-
224-
// advance the data-iterator to its corresponding match
225-
seekData(decodedValue)
226-
}
196+
// the value contains the full-resolution geometry and time; use them
197+
val decodedValue = IndexEntry.decodeIndexValue(indexSource.getTopValue)
198+
def isSTAcceptable = wrappedSTFilter(decodedValue.geom, decodedValue.dtgMillis)
199+
// see whether this box is acceptable
200+
// (the tests are ordered from fastest to slowest to take advantage of
201+
// short-circuit evaluation)
202+
if (isIdUnique(decodedValue.id) && isSTAcceptable) {
203+
// stash this ID
204+
rememberId(decodedValue.id)
205+
// advance the data-iterator to its corresponding match
206+
seekData(decodedValue)
227207
}
228208

229209
// you MUST advance to the next key
@@ -312,8 +292,7 @@ object SpatioTemporalIntersectingIterator extends IteratorHelpers
312292
* This trait contains many methods and values of general use to companion Iterator objects
313293
*/
314294
trait IteratorHelpers {
315-
def setOptions(cfg: IteratorSetting, schema: String, filter: Option[Filter]) {
316-
cfg.addOption(DEFAULT_SCHEMA_NAME, schema)
295+
def setOptions(cfg: IteratorSetting, filter: Option[Filter]) {
317296
filter.foreach { f => cfg.addOption(DEFAULT_FILTER_PROPERTY_NAME, ECQL.toCQL(f)) }
318297
}
319298
}

0 commit comments

Comments
 (0)