<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 02:59:39 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[SERVER-2333] mapreduce optimization: do not execute reduce on unique keys</title>
                <link>https://jira.mongodb.org/browse/SERVER-2333</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;By accident I had a wrong reduce method:&lt;br/&gt;
map = function() &lt;/p&gt;
{ emit(this.ln, 1); }
&lt;p&gt;reduce = function(key, vals) { var sum = 0; for (var val in vals) &lt;/p&gt;
{ sum += val; }
&lt;p&gt; return sum;  }&lt;/p&gt;

&lt;p&gt;The rows in collection actually have only 1 entry per this.ln.&lt;br/&gt;
If using inline the results look like:&lt;/p&gt;
		{
			&quot;_id&quot; : &quot;zzucdarlws&quot;,
			&quot;value&quot; : 1
		}

&lt;p&gt;If output goes to collection, it&apos;s&lt;br/&gt;
&amp;gt; db.output.find(&lt;/p&gt;
{&quot;_id&quot;: &quot;zzucdarlws&quot;}
&lt;p&gt;)&lt;/p&gt;
{ &quot;_id&quot; : &quot;zzucdarlws&quot;, &quot;value&quot; : &quot;00&quot; }

&lt;p&gt;It looks like for inline, the reduce function is never called, whereas it&apos;s called once for the collection.&lt;/p&gt;</description>
                <environment></environment>
        <key id="14167">SERVER-2333</key>
            <summary>mapreduce optimization: do not execute reduce on unique keys</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="9">Done</resolution>
                                        <assignee username="antoine">Antoine Girbal</assignee>
                                    <reporter username="antoine">Antoine Girbal</reporter>
                        <labels>
                    </labels>
                <created>Wed, 5 Jan 2011 21:39:36 +0000</created>
                <updated>Tue, 12 Jul 2016 00:19:56 +0000</updated>
                            <resolved>Tue, 25 Jan 2011 18:35:16 +0000</resolved>
                                                    <fixVersion>1.7.5</fixVersion>
                                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="118323" author="brianjohnson" created="Thu, 10 May 2012 19:58:17 +0000"  >&lt;p&gt;I filed &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-5818&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/SERVER-5818&lt;/a&gt; because I think this &quot;fix&quot; only applies to a very limited set of use cases. For instance, it would be a problem if you were summing values per key. If you only had a single key, you wouldn&apos;t get an aggregated count.&lt;/p&gt;</comment>
                            <comment id="22634" author="auto" created="Mon, 24 Jan 2011 23:40:00 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;login&apos;: u&apos;agirbal&apos;, u&apos;name&apos;: u&apos;agirbal&apos;, u&apos;email&apos;: u&apos;antoine@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-2333&quot; title=&quot;mapreduce optimization: do not execute reduce on unique keys&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-2333&quot;&gt;&lt;del&gt;SERVER-2333&lt;/del&gt;&lt;/a&gt;: added test&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/d45a6d5b1a6a9e8d0c8bc4b7bbe324f807e2357f&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/d45a6d5b1a6a9e8d0c8bc4b7bbe324f807e2357f&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="22633" author="auto" created="Mon, 24 Jan 2011 23:08:43 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;login&apos;: u&apos;agirbal&apos;, u&apos;name&apos;: u&apos;agirbal&apos;, u&apos;email&apos;: u&apos;antoine@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-2333&quot; title=&quot;mapreduce optimization: do not execute reduce on unique keys&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-2333&quot;&gt;&lt;del&gt;SERVER-2333&lt;/del&gt;&lt;/a&gt;: mapreduce: if results are inline vs into collection, it seems the execution may differ (different optimization?)&lt;br/&gt;
This was fixed, now reduce() isnt called for unique keys even when output to collection.&lt;/p&gt;

&lt;p&gt;Added many comments all around mr.cpp&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/58bbafbc57df03bd4cf06a15fa61e57baca59a11&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/58bbafbc57df03bd4cf06a15fa61e57baca59a11&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="22631" author="antoine" created="Mon, 24 Jan 2011 22:15:14 +0000"  >&lt;p&gt;Fixed this by not applying reduce() in case there is only 1 object, even for output to collection.&lt;br/&gt;
This should make mr quite a bit faster in some cases, since no js will be called.&lt;br/&gt;
Also added many comments in mr.cpp&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="89303">SERVER-10736</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>4.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Mon, 24 Jan 2011 23:08:43 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        11 years, 40 weeks, 6 days ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></customfieldvalue>


                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>ramon.fernandez@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            11 years, 40 weeks, 6 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Old_Backport</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10000"><![CDATA[No]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>antoine</customfieldvalue>
            <customfieldvalue>auto</customfieldvalue>
            <customfieldvalue>brianjohnson</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrp8v3:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrii1b:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>21574</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_23361" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Requested By</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10053" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time In Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_22870" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Triagers</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hsa2i7:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                    </customfields>
    </item>
</channel>
</rss>