Hi, I have below query formation in mapd crossfilter which gives me a sql as below:
SELECT COUNT(*) as val FROM PLACES WHERE ((latitude >= 19.69089672512304 AND latitude <= 56.78083875041932)) AND ((longitude >= -142.97341062499999 AND longitude <= -4.985129374999985))
var latitudeArr = [
var longitudeArr = [
crossfilter.dimension('latitude').setDrillDownFilter(true).filterAll().filterMulti(latitudeArr, false, false, null).groupAll().getCrossfilter().dimension('longitude').setDrillDownFilter(true).filterAll().filterMulti(longitudeArr, false, false, null).groupAll().reduceCount().writeQuery();
The issue I am facing is that the latitudeArr and longitudeArr are dynamic in nature but I am seeing previous filters on latitude and longitude going on appending which I do not want in my sql
SELECT COUNT(*) as val FROM PLACES_VER_111_NO_X WHERE ((latitude >= 19.69089672512304 AND latitude <= 56.78083875041932)) AND ((longitude >= -142.97341062499999 AND longitude <= -4.985129374999985)) AND ((latitude >= 19.69089672512304 AND latitude <= 56.78083875041932)) AND ((longitude >= -142.97341062499999 AND longitude <= -4.985129374999985))
Can anyone review my above code and suggest me a fix for this issue.
Hi @sachinpkaushik - Thanks for posting. We have a few people off this week because of the July 4th holiday, so apologies for the slow response. I’ve asked around internally to find someone more familiar with crossfilter than me, and I’ll make sure we get you an answer soon.
Any updates on my query?
We have someone taking a look. Should get back to this thread tomorrow latest. Thanks for your patience, @sachinpkaushik!
Hi @sachinpkaushik! Question: Are you re-using the same crossfilter instance to build each query? Crossfilter is stateful, so if you are then that would probably cause the behavior you are seeing.
If this doesn’t solve your problem, could you please post a full code example that reproduces the unexpected behavior?
Hi Jonathan the code that I have put in my query is the exact code that I use to create Sql.
Our intention is to reduce the number of calls made to the Mapd server.
For create new crossfilter instance every time u have to pass connection object and that causes server calls. What I am trying to achieve is reusability of the same crossfilter object as a service to create same sql again and again without having previous filters or where conditions. I hope I am clear with my query or can we connect?
@sachinpkaushik Still not sure exactly how you are passing the connection object. One option here (though without as much reuse) would be to just generate the SQL string from crossfilter and send that as the server query.
Another to clear all of the global filters at least would be to do this:
Hey @sachinpkaushik, just checking to see if this cleared up your issue? I’d be curious to hear more about your use case if you want to share. I’m always looking to hear more about how people are using the cross-filter API.
Hi Aaron it will help if we may connect online on skype so that I can explain the issue that I am facing with an example.