asterixdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Heri Ramampiaro <heri...@gmail.com>
Subject Re: Socket feed questions
Date Fri, 30 Oct 2015 17:10:47 GMT
The feeds test cases are under
asterix-app/src/test/resources/runtimets/queries/feeds

For the UDFs I believe the test cases are:
asterix-app/src/test/resources/runtimets/queries/user-defined-functions

I can prepare some simple examples till next week.

-heri


> On Oct 30, 2015, at 5:58 PM, Chen Li <chenli@gmail.com> wrote:
> 
> @Heri: do you know where to find the test cases of AQL UDF, or have some
> test cases of your own?  Jianfeng can start from there.
> 
> Chen
> 
> On Fri, Oct 30, 2015 at 12:30 AM, Heri Ramampiaro <heriram@gmail.com> wrote:
> 
>> 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 <kisskys@gmail.com> 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 <heriram@gmail.com>
>> 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
>> 
>> 


Mime
View raw message