Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-2199

mapReduce command doesn't tolerate null finalize attribute

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.7.5
    • Affects Version/s: 1.6.4
    • Component/s: None
    • None
    • ALL

      It appears that MR chokes if passed a null finalize function:

      > res = db.items.mapReduce(m, r);
      {
      "result" : "tmp.mr.mapreduce_1291928405_106",
      "timeMillis" : 3,
      "counts" :

      { "input" : 10, "emit" : 10, "output" : 8 }

      ,
      "ok" : 1,
      }
      > res = db.items.mapReduce(m, r,

      { finalize: null }

      );
      Thu Dec 9 13:00:14 uncaught exception: map reduce failed: {
      "assertion" : "not code",
      "assertionCode" : 10062,
      "errmsg" : "db assertion failure",
      "ok" : 0
      }

      The log indicates "can't convert type: 10 to code", which I take to mean MongoDB tried to treat the finalize attribute as code without first checking that it's null.

      Note that this is not the behavior of the query attribute:

      > res = db.items.mapReduce(m, r,

      { query: null }

      );
      {
      "result" : "tmp.mr.mapreduce_1291928582_108",
      "timeMillis" : 33,
      "counts" :

      { "input" : 10, "emit" : 10, "output" : 8 }

      ,
      "ok" : 1,
      }

      Besides simple consistency (and the lack of a more specific error message), it would be nice for MR to be null-safe in finalize because I have some utility code that handles cases both with and without a finalize attribute, and the easy thing is just to pass null as the finalize attribute in cases without it. (I can give illustrative Python code if needed.)

            Assignee:
            eliot Eliot Horowitz (Inactive)
            Reporter:
            jyrinx Luke Maurer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: