I am trying to create an adapter for Kairosdb. The kairosdb deals with json as input and output.
I have used Mongo-db adpter as reference.
The relations pushed down to kairos are :
1. Filter Relation
2. Join Relation
Filter Relation : Using somewhat same case in mongo-db adapter.
Join Relation : In kairosdb the data for a columnfamily can be huge, so its not a good idea to bring all the data in memory for handling Joins. So I tried a solution like this:
Keys are required to handle JOIN. In kairos db we can get keys from url, something like : http://[host]:[port]/api/v1/metricnames
So the flow to implement joins is like:
1. Identify the keys to compare from the other non kairos Table (which may be other datasource)
2. Push these keys to the kairos-enumerator, (I am using reflection for this. In linq4j project, EnumerableDefaults class has join_() and lookup_() methods. We can get an instance of kairos-enumerator here. From here we can call an utility method seyKeys() defined in kairos-enumerator)
3. Get all Keys from kairosdb .
4. Compare the two sets and get the disjunction of these two sets.
5. Send a request to Kairos for data of these keys
6. Create an ArrayList of result of objects and pass on to enumerator
Note : Attached here are the two files :
1. Linq4j . EnumerableDefaults :
a. Two methods. => toLookup2_() : This is newly added method(Corresponding changes in superclasses are not attached herewith), join_() : Some changes to pass keys at runtime.
KairosEnumerator = > setKey() : This is the method called from the join_() mentioned method above. This is used to set keys.
So my question is, Is this the right approach to implement an adapter for kairosdb. Or Is there any better way to do this ?
And will this be a realiable approach for newer versions of Optiq core and linq4j ?Thanking you,