Although I haven’t tested this (I have mostly used & created java-based UDFs),
one can execute AQL calls from within a UDF. Feeds allows functions to
execute arbitrary AQL statements (DDL, DMLs etc). I.e., I believe what
you are trying to do is possible.
For example you could do:
(Given that you have a rec. type called Tweet, and a dataset ProcessedTweets
create feed CoordTwitterFeed if not exists
using “push_twitter" (("type-name"="Tweet”))
apply function find-intersection;
(Here "find-intersection” is an AQL function that does the step specified under
2)).
To do nr. 3 the easiest way is to have a modified version of the “hashTag”
(let’s call this “tweetlocator”). Java-based UDF (see my previous message with
the
TweetLib example). You can then connect this as a secondary feed, connected to
“CoordTwitterFeed”.
E.g.:
create secondary feed ProcessedTwitterFeed from feed CoordTwitterFeed
apply function “tweelib#tweetlocator";
Thereafter you can connect the feeds to appropriate datasets.
(Since the find-intersection is an AQL function, you can also call
“tweelib#tweetlocator”
inside this function).
Best,
-heri
> On Oct 30, 2015, at 12:18 AM, Young-Seok Kim <[email protected]> wrote:
>
> I'm not sure whether the following UDF is possible or not, but hopefully it
> is.
> What we're trying to do is to have the following UDF.
>
> The UDF
> 1) accepts an incoming tweet record through a feed job as an input and then
> 2) takes a field, more specifically, coordinate field value from the tweet
> record and sends a spatial-intersect query using the coordinate in order to
> find out the corresponding county of the coordinates (we have created
> AsterixDB instance which stores US county shapes records into a dataset and
> created R-tree index on the polygon field of it, so the query will return
> the county effectively using the R-tree index)
> 3) creates a new tweet record consisting of the original record's fields +
> the returned county value
> 4) ingests to a tweet dataset in the AsterixDB instance.
>
> Can we have such an UDF?
>
> Best,
> Young-Seok
>
>
> On Thu, Oct 29, 2015 at 3:53 PM, Heri Ramampiaro <[email protected]> wrote:
>
>>>
>>> 2. Can we use AQL function in those kind of feed UDFs?
>>
>> Can you give an example of what you are trying to do?
>> I.e do you want to run an AQL inside a UDF or use an AQL function as a
>> UDF connected to a running feed?
>>
>> -heri