Skip to content

Commit

Permalink
Switch Kafka 2.1's getCountInternal to make the other implementations.
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Hughes <jhughes@ccri.com>
  • Loading branch information
Jim Hughes committed Feb 11, 2021
1 parent 4e51153 commit 4517979
Showing 1 changed file with 2 additions and 6 deletions.
Expand Up @@ -24,6 +24,7 @@ import org.locationtech.geomesa.filter.visitor.QueryPlanFilterVisitor
import org.locationtech.geomesa.kafka._
import org.locationtech.geomesa.kafka21.KafkaConsumerFeatureSource.FeatureSourceConsumer
import org.locationtech.geomesa.security.ContentFeatureSourceSecuritySupport
import org.locationtech.geomesa.utils.collection.SelfClosingIterator
import org.locationtech.geomesa.utils.geotools._
import org.opengis.feature.simple.SimpleFeatureType
import org.opengis.filter._
Expand Down Expand Up @@ -83,12 +84,7 @@ class KafkaConsumerFeatureSource(
builder.buildFeatureType()
}

override protected def getCountInternal(query: Query): Int = {
Option(query.getFilter).filter(_ != Filter.INCLUDE) match {
case None => featureCache.size()
case Some(f) => featureCache.size(f)
}
}
override protected def getCountInternal(query: Query): Int = SelfClosingIterator(getReaderInternal(query)).length

override protected def getReaderInternal(query: Query): FR = {
val filter = Option(query).map(_.getFilter).getOrElse(Filter.INCLUDE)
Expand Down

0 comments on commit 4517979

Please sign in to comment.