Search code examples
geotoolsaccumulogeomesa

Geomesa Feature Count always returning zero


I am developing geomesa client to perform basic read write and delete operations. I have also created a function which will return matching feature count for specified query, however it always returns zero, i also tried DataStore stats for fetching the matching feature count, it gives the correct result but operation is very slow. Below is my client code:

public int getRideCount(Long rideId) throws Exception {
    int count = 0;
    if(rideId != null){
      count = fs.getCount(new Query(tableName, CQL.toFilter("r="+rideId)));
      //count = ((Long) (ds.stats().getCount(sft, CQL.toFilter("r=" + rideId), true).get())).intValue();
    }
    return count;
  }

Can anyone help me in finding why it returning 0 though features exists in feature collections. or there exists other preferred techniques to fetch the matching feature count?. Any suggestion or clarifications are welcomed.


Solution

  • Based on the additional info from your email to the geomesa dev list, I believe this is caused by a bug in simple feature types that don't have a date attribute. I've opened a ticket here and a PR here for the issue. It should be fixed in the next release (1.3.2), or you can build the branch locally. In the meantime, the 'exact' counts should still work, although they will be slower. Instructions for enabling exact counts are here and here.