Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-8877

Built in reduces fail for Development Time Subset

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • 2.2.0
    • 2.1.0, 2.2.0
    • view-engine
    • Security Level: Public
    • None
    • MacOSX 64-bit

    Description

      Start couchbase with 64 buckets (either an OSX build or set the env. variable COUCHBASE_NUM_VBUCKETS=64)

      Load the beer-sample data set, create a view:

      map: function (doc, meta) {
      if (doc.type == "beer" && doc.brewery_id && typeof doc.abv == "number")

      { emit(doc.brewery_id, doc.abv); }

      }

      reduce: _stats

      With "Development Time Subset" selected, click "Show results".

      Returns the error:

      {error,<<"Builtin _stats function requires map values to be numbers">>}

      Thrown from: https://github.com/couchbase/couchdb/blob/4629c5167a877c7110dd55c27a7e1028558e5da4/src/couchdb/couch_view_mapreduce.erl#L267

      if I log the input to builtin_stats from there i see:

      [

      {<<"[\"alaskan_brewing\",\"alaskan_brewing-alaskan_summer_ale\"]">>, <<"5.3">>}

      ,

      {<<"[\"allentown_brew_works\",\"allentown_brew_works-pumpkin_ale\"]">>, <<"5.2">>}

      ,

      {<<"[\"anheuser_busch\",\"anheuser_busch-bare_knuckle_stout\"]">>, <<"0">>}

      ,

      {<<"[\"appalachian_brewing_company\",\"appalachian_brewing_company-pennypacker_porter\"]">>, <<"5.4">>}

      ,

      {<<"[\"appalachian_brewing_company\",\"appalachian_brewing_company-zoigl_star_lager\"]">>, <<"5.9">>}

      ,

      {<<"[\"avery_brewing_company\",\"avery_brewing_company-old_jubilation_ale\"]">>, <<"8">>}

      ]

      When the KV list is being passed to the builtin_stats function in this case, these numbers are still strings (but they were definitely emitted as numbers), causing the when(is_number, First) guard in the second clause to fail.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            FilipeManana Filipe Manana (Inactive)
            aaron Aaron Miller (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty