<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:48:35 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-59951] Make object form of the &apos;_id&apos; group-by expression work to handle multiple group-by keys.</title>
                <link>https://jira.mongodb.org/browse/SERVER-59951</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Currently $group SBE stage builder (&lt;tt&gt;SlotBasedStageBuilder::buildGroup&lt;/tt&gt;) does not support object form of the &apos;_id&apos; group-by expression like _id: {a: &quot;$a&quot;, b: &quot;$b&quot;}. Two ideas were proposed so far.&lt;/p&gt;

&lt;p&gt;1) One idea is to pass through &lt;tt&gt;ExpressionObject&lt;/tt&gt;&#160;from &lt;tt&gt;DocumentSourceGroup&lt;/tt&gt; to &lt;tt&gt;GroupNode&lt;/tt&gt; QSN to &lt;tt&gt;SlotBasedStageBuilder::buildGroup&lt;/tt&gt; and implement the expression walker for &lt;tt&gt;ExpressionObject&lt;/tt&gt;.&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;We would get $object implementation almost for free too.&lt;/li&gt;
	&lt;li&gt;The group stage&apos;s group key becomes a full document with field names which would be less performing compared to multiple group-by keys just like the second idea.&lt;/li&gt;
	&lt;li&gt;We would get the same behavior as the classic engine for generated _id documents.&lt;/li&gt;
	&lt;li&gt;We need to modify &lt;tt&gt;DocumentSourceGroup&lt;/tt&gt;&#160;and &lt;tt&gt;GroupNode&lt;/tt&gt;. There would be chaining changes.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;2) Another idea is to insert a &lt;tt&gt;mkbson&lt;/tt&gt;&#160;stage manually to compose a _id document out of multiple group-by key expressions before returning a result document.&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;We don&apos;t need to modify &lt;tt&gt;DocumentSourceGroup&lt;/tt&gt; and &lt;tt&gt;GroupNode&lt;/tt&gt;. We just need to add some logic to &lt;tt&gt;SlotBasedStageBuilder::buildGroup&lt;/tt&gt;.&lt;/li&gt;
	&lt;li&gt;The group stage&apos;s group key becomes multiple group-by key without field names which would be better performing compared to the first idea.&lt;/li&gt;
	&lt;li&gt;We would not get the same behavior as the classic engine since passed-through group-by key expressions do not follow the original order in _id document specification.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Maybe we can follow a hybrid approach to get the best out of two approaches above though code changes would be bigger.&lt;/p&gt;

&lt;p&gt;1. Pass through &lt;tt&gt;ExpressionObject&lt;/tt&gt; from &lt;tt&gt;DocumentSourceGroup&lt;/tt&gt; to &lt;tt&gt;GroupNode&lt;/tt&gt; QSN to &lt;tt&gt;SlotBasedStageBuilder::buildGroup&lt;/tt&gt; and implement the expression walker for &lt;tt&gt;ExpressionObject&lt;/tt&gt;.&lt;br/&gt;
2. Extract slots and expressions for _id document fields from the generated SBE PlanStage tree from &lt;tt&gt;ExpressionObject&lt;/tt&gt; to pass them to &lt;tt&gt;makeHashAgg&lt;/tt&gt; inside &lt;tt&gt;SlotBasedStageBuilder::buildGroup&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;Pros:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;We would get the same behavior as the classic engine for generated _id documents.&lt;/li&gt;
	&lt;li&gt;We would get the better performance for group stage.&lt;/li&gt;
	&lt;li&gt;We would get $object implementation almost for free too.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Cons:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Code changes would be bigger like more changes to &lt;tt&gt;SlotBasedStageBuilder::buildGroup&lt;/tt&gt; and &lt;tt&gt;DocumentSourceGroup&lt;/tt&gt; and &lt;tt&gt;GroupNode&lt;/tt&gt; and chaining changes.&lt;/li&gt;
&lt;/ul&gt;
</description>
                <environment></environment>
        <key id="1874086">SERVER-59951</key>
            <summary>Make object form of the &apos;_id&apos; group-by expression work to handle multiple group-by 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="13201">Fixed</resolution>
                                        <assignee username="yoonsoo.kim@mongodb.com">Yoon Soo Kim</assignee>
                                    <reporter username="yoonsoo.kim@mongodb.com">Yoon Soo Kim</reporter>
                        <labels>
                    </labels>
                <created>Tue, 14 Sep 2021 19:43:56 +0000</created>
                <updated>Sun, 29 Oct 2023 21:48:37 +0000</updated>
                            <resolved>Wed, 19 Jan 2022 22:07:16 +0000</resolved>
                                                    <fixVersion>5.3.0</fixVersion>
                                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="4301580" author="xgen-internal-githook" created="Wed, 19 Jan 2022 22:04:25 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Yoonsoo Kim&apos;, &apos;email&apos;: &apos;yoonsoo.kim@mongodb.com&apos;, &apos;username&apos;: &apos;yun-soo&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-59951&quot; title=&quot;Make object form of the &amp;#39;_id&amp;#39; group-by expression work to handle multiple group-by keys.&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-59951&quot;&gt;&lt;del&gt;SERVER-59951&lt;/del&gt;&lt;/a&gt; Support document _id expression&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/ab99324a4ac6e15f1805fbfce29f90832f471330&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/ab99324a4ac6e15f1805fbfce29f90832f471330&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10520">
                    <name>Problem/Incident</name>
                                            <outwardlinks description="causes">
                                        <issuelink>
            <issuekey id="2006950">SERVER-64812</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>6.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10038"><![CDATA[Fully Compatible]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Fri, 14 Jan 2022 22:36:25 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        2 years, 3 weeks 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_17050" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Downstream Team Attention</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="16941"><![CDATA[Not Needed]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>PM-2267</customfieldvalue>
                        </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>luke.bonanomi@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            2 years, 3 weeks ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>yoonsoo.kim@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i01lrb:</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</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_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="5271">QE 2021-11-15</customfieldvalue>
    <customfieldvalue id="5273">QE 2021-11-29</customfieldvalue>
    <customfieldvalue id="5275">QE 2021-12-13</customfieldvalue>
    <customfieldvalue id="5277">QE 2021-12-27</customfieldvalue>
    <customfieldvalue id="5279">QE 2022-01-10</customfieldvalue>
    <customfieldvalue id="5810">QE 2022-01-24</customfieldvalue>

                        </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|i017wn:</customfieldvalue>

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