Hi

As an update.......I did get it to work and still wondering if correct even
though I did get data.

filters = key_filter.tokenize(":",5).eq(country) \
    &  key_filter.tokenize(":", 2).eq(campaign_id) \
    &  key_filter.tokenize(":", 4).string_to_int().less_than_eq(date_end) \
    &  key_filter.tokenize(":",
4).string_to_int().greater_than_eq(date_start)
    query.add_key_filters(filters)

I changed the & to a | for the date range.  This was a tough bug to track
down yet so simple and image that is why I get the error in the log file.

Thanks



On Sat, Dec 22, 2012 at 3:39 PM, David Montgomery <davidmontgom...@gmail.com
> wrote:

> Hi,
>
> Thanks...... in my mapper I added obj={} which I left out.
>
> But still cant get MR to work but left out that i am using filters.  I get
> the same error and am wondering if I am using key filters correct.
>     {'uuid':1,'campaign_id':2,'adgroup_id':3,'date':4,'country':5}
>
>     filters = key_filter.tokenize(":",5).eq(country) \
>     &  key_filter.tokenize(":", 2).eq(campaign_id) \
>     &  key_filter.tokenize(":", 4).string_to_int().less_than_eq(date_end) \
>     &  key_filter.tokenize(":",
> 4).string_to_int().greater_than_eq(date_start)
>     query.add_key_filters(filters)
>
> '[['and', [['tokenize', ':', 5], ['eq', 'SG']], [['tokenize', ':', 2],
> ['eq', 'cid5989410021']], [['tokenize', ':', 4], ['string_to_int'],
> ['less_than_eq', '2012122509']], [['tokenize', ':', 4],
> ['string_to_int'], ['greater_than_eq', '2012121810']]]]
>
> If I leave out &  key_filter.tokenize(":",
> filter_map['date']).string_to_int().greater_than_eq(date_start) the query
> works and I get the data I want.  If I include then I get the error.
> So...what I cant figure out is why I cant use the last filter.  My key
> looks like this.
> 07712f3d-6661-44a7-89ff-4e4ed3b5f5a6:cid5989410021:agid7744464312:2012122205:SG
>
> uuid:campaign_id:aid:date:country where date is in YYYYMMDDHH format
>
> I just want a query that will filter by campaign_id, country, and between
> a date range.
>
> thanks
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> On Thu, Dec 20, 2012 at 11:07 PM, Bryan Fink <br...@basho.com> wrote:
>
>> On Thu, Dec 20, 2012 at 8:52 AM, David Montgomery
>> <davidmontgom...@gmail.com> wrote:
>> >
>> {fitting_exited_abnormally,[{<<"lineno">>,3},{<<"message">>,<<"TypeError:
>> > reduce of empty array with no initial value">>}
>>
>> Hi, David. The error is occurring on line three of your reduce
>> function, where it calls `values.reduce`:
>>
>> > query.reduce('''
>> >     function(values, arg){
>> >         return [ values.reduce( function(acc, item) {
>> ...
>>
>> It's complaining about the fact that `values` is an empty array, so
>> `values.reduce` doesn't know what to do. You will need to either
>> include an initial value as a second parameter, like:
>>
>>     values.reduce(function(acc, item) { ... },
>>                   {}) //initial empty object
>>
>> Or check to see if `values` is empty before reducing, like the Riak JS
>> reduce builtins do:
>>
>> https://github.com/basho/riak_kv/blob/master/priv/mapred_builtins.js#L68
>>
>> Cheers,
>> Bryan
>>
>
>
_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to