incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yue Chuan Lim <shasder...@gmail.com>
Subject Re: Crash when using builtin reduce _stats
Date Sat, 07 Aug 2010 00:21:33 GMT
I highly doubt it, modifying the function to:

function(doc) {
  if(doc.data[12] > 0) {
    key = doc._id.split("|")[0];
    emit(doc.data[12], doc.data[12]);
  }
}

and sorting by key, it appears all the numbers are indeed numbers.

function(doc) {
  if(doc.data[12] > 0) {
    key = doc._id.split("|")[0];
    if(doc.data[12] != parseInt(doc.data[12])) {
      emit(doc.data[12], doc.data[12]);
    }
  }
}

Returns a empty set.

On a hunch, I removed the doc.data[12] > 0 line, and the query seems to run
fine

(with group=true)

{"rows":[
{"key":"gsc_test_01","value":{"sum":335168,"count":1000,"min":0,"max":389,"sumsqr":128263850}},
{"key":"gsc_test_02","value":{"sum":381805,"count":1000,"min":0,"max":765,"sumsqr":176920147}},
{"key":"gsc_test_03","value":{"sum":411391,"count":1000,"min":187,"max":761,"sumsqr":178307983}}
]}

So it appears that _stats doesn't like value sets without 0s :P (or maybe
reduce + group=true has something against unequal count values)

Thanks for looking into this :)
Yue Chuan


On Sat, Aug 7, 2010 at 8:13 AM, J Chris Anderson <jchris@apache.org> wrote:

>
> On Aug 6, 2010, at 5:09 PM, Yue Chuan Lim wrote:
>
> > Further tested on the couch.io windows installer as well as a
> > couch.ioinstance with the same results, works on a temp view, crashes
> > on a actual
> > view.
> >
> >
> shasderias.couchone_remove_me_.com/_utils/database.html?gsc_lt2/_design/stats/_view/active_power
> >
> > is the couchone instance.
>
> Is there any chance you have a few docs where the value is not a number? If
> you remove the reduce function completely and query the map is every single
> row's value a number?
>
> Thanks for helping us get to the bottom of this.
>
> Chris
>
> >
> > On Fri, Aug 6, 2010 at 9:01 PM, Yue Chuan Lim <shasderias@gmail.com>
> wrote:
> >
> >> And curiously enough, running it as a temp view works just fine.
> >>
> >> [info] [<0.1859.0>] 127.0.0.1 - - 'POST'
> >> /gsc_lt2/_temp_view?limit=11&descending=true&group=true 200
> >>
> >>
> >> On Fri, Aug 6, 2010 at 8:38 PM, Yue Chuan Lim <shasderias@gmail.com
> >wrote:
> >>
> >>> Fairly standard map/reduce function, map looks something like
> >>>
> >>> function(doc) {
> >>>  if(doc.data[12] > 0) {
> >>>    key = doc._id.split("|")[0];
> >>>    emit(key, doc.data[12]);
> >>>  }
> >>> }
> >>>
> >>> Data returned by map is along the lines of: ("test1", 123), ("test1",
> >>> 245).
> >>>
> >>> Reduce is just: _stats
> >>>
> >>> Crash log: http://pastebin.com/aX7jeeLm
> >>> Platform: Windows 7 (32-bit)
> >>>
> >>> Using the installer by Mark Hammond. Incidentally, is the installer on
> >>> couch.io the preferred one for windows deployment?
> >>>
> >>> Thanks
> >>>
> >>>
> >>>
> >>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message