Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [geomesa-users] Geomesa HBase query cache

The hints object is basically a hashmap. Off the top of my head, you'd want to do:

query.getHints().put(QueryHints.EXACT_COUNT(), java.lang.Boolean.TRUE);

Let me know if that doesn't work.

Thanks,

Emilio

On 03/01/2017 10:53 AM, Jose Bujalance wrote:
Hi,

I understand that if I change the value of the geomesa.force.count property in the geomesa-site.xml and set it to true, all the queries will return the exact value.
However, can you please explain me how to set it on a per-query basis in Java ?

I have tried this :

myQuery.setHints(QueryHints.EXACT_COUNT());

But there is a type mismatch as the method setHints(Hints) in the type Query is not applicable for the arguments (Hints.ClassKey)

I'm sorry but I don't fully understand how to use it.

Thanks,

José

2017-03-01 16:11 GMT+01:00 Emilio Lahr-Vivaz <elahrvivaz@xxxxxxxx>:
Hi José,

You have two options - you can return exact counts on a per-query basis by setting a query hint, or you can always return exact counts by setting a system property. Details are here:

http://www.geomesa.org/documentation/user/datastores/runtime_config.html#geomesa-force-count

Note that in order to calculate the count, we have to retrieve all the results - so it will end up running your query twice if you then iterate through the results.

I also checked the code, and it should be returning the exact count since cached stats are implemented - I'll open up a ticket and look into it. (this doesn't apply to the command line)

Thanks,

Emilio


On 03/01/2017 09:53 AM, Jose Bujalance wrote:
Hi Emilio,

Thanks again for your answer. This is how I am getting the count in the Java code:

Let's say I am querying a SimpleFeatureType called mySft, in a Geomesa catalog (DataStore object) called myDs.
First, I create a Query object, lets call it myQuery, from a predicate which I then convert into a CQL filter.
Once I have the query, I retrieve a list of the matching features using this lines:

SimpleFeatureSource featSource = myDs.getFeatureSource(mtSft.getName());
SimpleFeatureCollection featCol = featSource.getFeatures(myQuery);

Finally, I just return the size of the featCol object.

Thanks,

José.

2017-03-01 15:40 GMT+01:00 Emilio Lahr-Vivaz <elahrvivaz@xxxxxxxx>:
Hi José,

We haven't implemented caching of stats yet for hbase. Because of this, any time you ask for cached stats it will return empty. If you ask for --no-cache, it will run the stats, but it still won't store the results.

How are you calling the count method in Java? There are various options for not returning the cached counts depending on what you're doing.

Thanks,

Emilio


On 03/01/2017 09:21 AM, Jose Bujalance wrote:
Hello,

I have been trying to do some queries on Geomesa HBase and I have some problems with the cache.
First of all, I have made a jar where I query a Geomesa catalog with a BBox. After seeing that Geomesa returned 0 points (which I have verified that is not true), I have done the same query on the Geomesa command line. The result is again 0. However, when I make the exact same query adding the flag --no-cahe, then I get the correct result:

geomesa-hbase stats-count -c Geoloc_Praxedo_catalog -f history_feature_nodate_conf -q 'BBOX(coords, 48.815215, 2.249294, 48.904295, 2.419337)' --no-cache

What seems strange to me is that even after having calculated the 'count' with the --no-cache flag, when I execute the same query again without the flag, it still keeps on returning 0.

So my questions are:
1) Where is this cache memory stored ?
2) How is the cache updated ?
3) Can I remove this option from the java API (something equivalent to the flag --no-cache), so that when I execute my jar it doesn't return the 0 value stored in the cache ?

Thanks a lot for your time.

All the best,
José


_______________________________________________
geomesa-users mailing list
geomesa-users@xxxxxxxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.locationtech.org/mailman/listinfo/geomesa-users
_______________________________________________ geomesa-users mailing list geomesa-users@xxxxxxxxxxxxxxxx To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.locationtech.org/mailman/listinfo/geomesa-users
_______________________________________________
geomesa-users mailing list
geomesa-users@xxxxxxxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.locationtech.org/mailman/listinfo/geomesa-users
_______________________________________________ geomesa-users mailing list geomesa-users@xxxxxxxxxxxxxxxx To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.locationtech.org/mailman/listinfo/geomesa-users
_______________________________________________
geomesa-users mailing list
geomesa-users@xxxxxxxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.locationtech.org/mailman/listinfo/geomesa-users

Back to the top