diff --git a/geomesa-accumulo/geomesa-accumulo-datastore/src/test/scala/org/locationtech/geomesa/accumulo/data/AccumuloFeatureReaderTest.scala b/geomesa-accumulo/geomesa-accumulo-datastore/src/test/scala/org/locationtech/geomesa/accumulo/data/AccumuloFeatureReaderTest.scala index 9209cbd1f4ce..15ca4f856c91 100644 --- a/geomesa-accumulo/geomesa-accumulo-datastore/src/test/scala/org/locationtech/geomesa/accumulo/data/AccumuloFeatureReaderTest.scala +++ b/geomesa-accumulo/geomesa-accumulo-datastore/src/test/scala/org/locationtech/geomesa/accumulo/data/AccumuloFeatureReaderTest.scala @@ -98,28 +98,6 @@ class AccumuloFeatureReaderTest extends Specification with TestWithFeatureType { events.head.asInstanceOf[QueryEvent].hits mustEqual 100 } - "be able to count bin results in stats through geoserver" in { - val events = ArrayBuffer.empty[AuditedEvent] - - val query = new Query(sftName, filter) - val collection = dataStoreWithAudit(events).getFeatureSource(sftName).getFeatures(query) - - // put the hints in the request after getting the feature collection - // to mimic the bin output format workflow - val hints = Map(QueryHints.BIN_TRACK -> "name", QueryHints.BIN_BATCH_SIZE -> 10) - QueryPlanner.setPerThreadQueryHints(hints.asInstanceOf[Map[AnyRef, AnyRef]]) - - var count = 0 - val reader = collection.features() - while (reader.hasNext) { reader.next(); count += 1 } - reader.close() - - count must beLessThan(100) - events must haveLength(1) - events.head must beAnInstanceOf[QueryEvent] - events.head.asInstanceOf[QueryEvent].hits mustEqual 100 - } - "be able to limit features" in { val query = new Query(sftName, filter) query.setMaxFeatures(10) @@ -146,23 +124,6 @@ class AccumuloFeatureReaderTest extends Specification with TestWithFeatureType { count mustEqual 10 * 16 // 16 bytes per bin record } - "be able to limit features in bin results through geoserver" in { - val query = new Query(sftName, filter) - query.setMaxFeatures(10) - - val collection = ds.getFeatureSource(sftName).getFeatures(query) - - val hints = Map(QueryHints.BIN_TRACK -> "name", QueryHints.BIN_BATCH_SIZE -> 10) - QueryPlanner.setPerThreadQueryHints(hints.asInstanceOf[Map[AnyRef, AnyRef]]) - - var count = 0 - val reader = collection.features() - while (reader.hasNext) { count += reader.next().getAttribute(0).asInstanceOf[Array[Byte]].length } - reader.close() - - count mustEqual 10 * 16 // 16 bytes per bin record - } - "be able to limit features and collect stats" in { val events = ArrayBuffer.empty[AuditedEvent] val query = new Query(sftName, filter) @@ -196,28 +157,5 @@ class AccumuloFeatureReaderTest extends Specification with TestWithFeatureType { events.head must beAnInstanceOf[QueryEvent] events.head.asInstanceOf[QueryEvent].hits must beLessThan(20L) } - - "be able to limit features in bin results and collect stats through geoserver" in { - val events = ArrayBuffer.empty[AuditedEvent] - val query = new Query(sftName, filter) - query.setMaxFeatures(10) - - val collection = dataStoreWithAudit(events).getFeatureSource(sftName).getFeatures(query) - - // put the hints in the request after getting the feature collection - // to mimic the bin output format workflow - val hints = Map(QueryHints.BIN_TRACK -> "name", QueryHints.BIN_BATCH_SIZE -> 10) - QueryPlanner.setPerThreadQueryHints(hints.asInstanceOf[Map[AnyRef, AnyRef]]) - - var count = 0 - val reader = collection.features() - while (reader.hasNext) { count += reader.next().getAttribute(0).asInstanceOf[Array[Byte]].length } - reader.close() - - count mustEqual 10 * 16 // 16 bytes per bin record - events must haveLength(1) - events.head must beAnInstanceOf[QueryEvent] - events.head.asInstanceOf[QueryEvent].hits mustEqual 10L - } } } diff --git a/geomesa-index-api/src/main/scala/org/locationtech/geomesa/index/planning/QueryPlanner.scala b/geomesa-index-api/src/main/scala/org/locationtech/geomesa/index/planning/QueryPlanner.scala index d3cac6281b29..aea7c8bb4311 100644 --- a/geomesa-index-api/src/main/scala/org/locationtech/geomesa/index/planning/QueryPlanner.scala +++ b/geomesa-index-api/src/main/scala/org/locationtech/geomesa/index/planning/QueryPlanner.scala @@ -162,15 +162,19 @@ object QueryPlanner extends LazyLogging { import org.locationtech.geomesa.utils.geotools.RichSimpleFeatureType.RichSimpleFeatureType - private [planning] val threadedHints = new SoftThreadLocal[Map[AnyRef, AnyRef]] + private[planning] val threadedHints = new SoftThreadLocal[Map[AnyRef, AnyRef]] object CostEvaluation extends Enumeration { type CostEvaluation = Value val Stats, Index = Value } + // threaded hints were used as a work-around with wfs output formats, but now we use GetFeatureCallback instead + @deprecated("Deprecated with no replacement") def setPerThreadQueryHints(hints: Map[AnyRef, AnyRef]): Unit = threadedHints.put(hints) + @deprecated("Deprecated with no replacement") def getPerThreadQueryHints: Option[Map[AnyRef, AnyRef]] = threadedHints.get + @deprecated("Deprecated with no replacement") def clearPerThreadQueryHints(): Unit = threadedHints.clear() /** diff --git a/geomesa-index-api/src/main/scala/org/locationtech/geomesa/index/view/MergedQueryRunner.scala b/geomesa-index-api/src/main/scala/org/locationtech/geomesa/index/view/MergedQueryRunner.scala index 004c68e79101..dd9d9bea54fb 100644 --- a/geomesa-index-api/src/main/scala/org/locationtech/geomesa/index/view/MergedQueryRunner.scala +++ b/geomesa-index-api/src/main/scala/org/locationtech/geomesa/index/view/MergedQueryRunner.scala @@ -120,6 +120,7 @@ class MergedQueryRunner( val query = new Query(original) // set the thread-local hints once, so that we have them for each data store that is being queried + // noinspection ScalaDeprecation QueryPlanner.getPerThreadQueryHints.foreach { hints => hints.foreach { case (k, v) => query.getHints.put(k, v) } // clear any configured hints so we don't process them again