<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 06:53:56 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-84061] Investigate NaN behavior in SBE</title>
                <link>https://jira.mongodb.org/browse/SERVER-84061</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;When comparing two doubles, valueCompare will call compareDoubles in compare_numbers.h so two NaN&apos;s will compare equal to each other. &lt;a href=&quot;https://github.com/mongodb/mongo/blob/e67290f658e1a8529935f3c842fe9c25ccf420bf/src/mongo/base/compare_numbers.h#L58&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/blob/e67290f658e1a8529935f3c842fe9c25ccf420bf/src/mongo/base/compare_numbers.h#L58&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When using genericCompare&amp;lt;std::equal_to&amp;lt;&amp;gt;&amp;gt;, no special case exists for NaN when both values are doubles, so it will fall back to using operator== for doubles. This means that when using genericCompare, NaN != NaN.&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/blob/e67290f658e1a8529935f3c842fe9c25ccf420bf/src/mongo/db/exec/sbe/vm/vm.h#L99&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/blob/e67290f658e1a8529935f3c842fe9c25ccf420bf/src/mongo/db/exec/sbe/vm/vm.h#L99&lt;/a&gt;&lt;/p&gt;</description>
                <environment></environment>
        <key id="2521744">SERVER-84061</key>
            <summary>Investigate NaN behavior in SBE</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</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="13202">Works as Designed</resolution>
                                        <assignee username="parker.felix@mongodb.com">Parker Felix</assignee>
                                    <reporter username="parker.felix@mongodb.com">Parker Felix</reporter>
                        <labels>
                    </labels>
                <created>Mon, 11 Dec 2023 17:25:41 +0000</created>
                <updated>Tue, 9 Jan 2024 19:27:04 +0000</updated>
                            <resolved>Tue, 9 Jan 2024 19:27:03 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="5998331" author="JIRAUSER1269502" created="Tue, 9 Jan 2024 19:23:57 +0000"  >&lt;p&gt;When doing an equality comparison to a constant, SBE will use a special &lt;tt&gt;Instruction::isNaN&lt;/tt&gt; instead of the regular&#160;&lt;tt&gt;Instruction::eq&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;For example &lt;tt&gt;aggregate(&lt;span class=&quot;error&quot;&gt;&amp;#91;\{$match: {a: {$eq: 1.0}}}&amp;#93;&lt;/span&gt;) }}will use {{Instruction::eq&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;On the other hand aggregate(&lt;span class=&quot;error&quot;&gt;&amp;#91;\{$match: {a: {$eq: isNaN}}}&amp;#93;&lt;/span&gt;) or aggregate(&lt;span class=&quot;error&quot;&gt;&amp;#91;\{$match: {a: {$eq: 0 / 0}}}&amp;#93;&lt;/span&gt;) will use &lt;tt&gt;Instruction::isNaN&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;The logic for this distinction can be found in &lt;a href=&quot;https://github.com/mongodb/mongo/blob/b4884531b60c8bcd911a143e65eea326ff895a85/src/mongo/db/query/sbe_shared_helpers.h#L44&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;generateComparisonExpr&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;When the value being compared to isn&apos;t known at the time of plan generation, &lt;tt&gt;Instruction::cmp3w&lt;/tt&gt; will be used instead. This instruction calls &lt;a href=&quot;https://github.com/mongodb/mongo/blob/636d0c1ce26d905cc508a73ada598950e16860b5/src/mongo/db/exec/sbe/vm/arith.cpp#L1223&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;ByteCode::compare3way&lt;/a&gt; which calls &lt;tt&gt;valueCompare&lt;/tt&gt;, which in turn calls &lt;tt&gt;compareDoubles&lt;/tt&gt; which captures the MQL semantics that NaN should compare equal to NaN.&lt;/p&gt;

&lt;p&gt;For example {{aggregate([{&quot;$project&quot;: {&quot;abEq&quot;: &lt;/p&gt;
{&quot;$eq&quot;:[&quot;$a&quot;, &quot;$b&quot;]}
&lt;p&gt;}}])}} will use &lt;tt&gt;Instruction::cmp3w&lt;/tt&gt; and the result of the three way comparison will then be processed by &lt;tt&gt;Instruction::eq&lt;/tt&gt; that checks if the result of &lt;tt&gt;Instruction::cmp3w&lt;/tt&gt; was 0.&lt;/p&gt;</comment>
                    </comments>
                    <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>2.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25125"><![CDATA[Query Execution]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        4 weeks, 1 day 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>parker.felix@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            4 weeks, 1 day ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_10032" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Operating System</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10026"><![CDATA[ALL]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>parker.felix@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i344g7:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|i2lw5w:</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="8043">QE 2024-01-08</customfieldvalue>
    <customfieldvalue id="8060">QE 2024-01-22</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|i33qlj:</customfieldvalue>

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