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

A MapReduce with out = {reduce: "coll"} should not have a finalize function since its output type does not match the reduce's input type

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 1.7.4
    • Component/s: MapReduce
    • Labels:
      None
    • ALL

      The 'out' option for mapreduce command can be given the 'reduce' option, which according to the wiki documentation:
      "

      { reduce : 'collectionName' }

      - If documents exists for a given key in the result set and in the old collection, then a reduce operation (using the specified reduce function) will be performed on the two values and the result will be written to the output collection. If a finalize function was provided, this will be run after the reduce as well."

      The problem is the reduce function has type "[a] -> a" but the finalize function has type "a -> b". If you run the same mapreduce that has a finalize function more than once with out =

      {reduce: "coll"}

      , the previous result will have a value of type "b" but the next mapreduce will try to reduce it expecting a value of type "a".

            Assignee:
            Unassigned Unassigned
            Reporter:
            tonyh Tony Hannan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: