{"action":"created","comment":{"url":"https://api.github.com/repos/aspnet/EntityFramework/pulls/comments/43950881","id":43950881,"diff_hunk":"@@ -7,78 +7,66 @@ namespace Microsoft.Data.Entity.Query.ExpressionVisitors.Internal\n {\n     public class RelationalNullsOptimizedExpandingVisitor : RelationalNullsExpressionVisitorBase\n     {\n-        public virtual bool OptimizedExpansionPossible { get; set; }\n+        public virtual bool IsOptimalExpansion { get; private set; } = true;\n \n-        public RelationalNullsOptimizedExpandingVisitor()\n+        protected override Expression VisitBinary(BinaryExpression binaryExpression)\n         {\n-            OptimizedExpansionPossible = true;\n-        }\n-\n-        protected override Expression VisitBinary(BinaryExpression expression)\n-        {\n-            var left = Visit(expression.Left);\n-            var right = Visit(expression.Right);\n+            var newLeft = Visit(binaryExpression.Left);\n+            var newRight = Visit(binaryExpression.Right);\n \n-            if (!OptimizedExpansionPossible)\n+            if (!IsOptimalExpansion)\n             {\n-                return expression;\n+                return binaryExpression;\n             }\n \n-            if (expression.NodeType == ExpressionType.Equal\n-                || expression.NodeType == ExpressionType.NotEqual)\n+            if (binaryExpression.NodeType == ExpressionType.Equal\n+                || binaryExpression.NodeType == ExpressionType.NotEqual)\n             {\n-                var leftIsNull = BuildIsNullExpression(left);\n-                var rightIsNull = BuildIsNullExpression(right);\n+                var leftIsNull = BuildIsNullExpression(newLeft);\n+                var rightIsNull = BuildIsNullExpression(newRight);\n+\n                 var leftNullable = leftIsNull != null;\n                 var rightNullable = rightIsNull != null;\n \n-                if (expression.NodeType == ExpressionType.Equal\n+                if (binaryExpression.NodeType == ExpressionType.Equal\n                     && leftNullable\n                     && rightNullable)\n                 {\n                     return Expression.OrElse(\n-                        Expression.Equal(left, right),\n-                        Expression.AndAlso(\n-                            leftIsNull,\n-                            rightIsNull\n-                            )\n-                        );\n+                        Expression.Equal(newLeft, newRight),\n+                        Expression.AndAlso(leftIsNull, rightIsNull));\n                 }\n \n-                if (expression.NodeType == ExpressionType.NotEqual\n+                if (binaryExpression.NodeType == ExpressionType.NotEqual\n                     && (leftNullable || rightNullable))\n                 {\n-                    OptimizedExpansionPossible = false;\n+                    IsOptimalExpansion = false;\n                 }\n             }\n \n-            if (left == expression.Left\n-                && right == expression.Right)\n-            {\n-                return expression;\n-            }\n-\n-            return Expression.MakeBinary(expression.NodeType, left, right, expression.IsLiftedToNull, expression.Method);\n+            return newLeft != binaryExpression.Left","path":"src/EntityFramework.Relational/Query/ExpressionVisitors/Internal/RelationalNullsOptimizedExpandingVisitor.cs","position":72,"original_position":72,"commit_id":"2e16c3ad19fbb2c721dfe8e8baad9e1774446f99","original_commit_id":"2e16c3ad19fbb2c721dfe8e8baad9e1774446f99","user":{"login":"maumar","id":1591930,"avatar_url":"https://avatars.githubusercontent.com/u/1591930?v=3","gravatar_id":"","url":"https://api.github.com/users/maumar","html_url":"https://github.com/maumar","followers_url":"https://api.github.com/users/maumar/followers","following_url":"https://api.github.com/users/maumar/following{/other_user}","gists_url":"https://api.github.com/users/maumar/gists{/gist_id}","starred_url":"https://api.github.com/users/maumar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maumar/subscriptions","organizations_url":"https://api.github.com/users/maumar/orgs","repos_url":"https://api.github.com/users/maumar/repos","events_url":"https://api.github.com/users/maumar/events{/privacy}","received_events_url":"https://api.github.com/users/maumar/received_events","type":"User","site_admin":false},"body":"apparently this check is built into the Update method, so we could remove it","created_at":"2015-11-04T22:37:27Z","updated_at":"2015-11-04T22:37:27Z","html_url":"https://github.com/aspnet/EntityFramework/pull/3653#discussion_r43950881","pull_request_url":"https://api.github.com/repos/aspnet/EntityFramework/pulls/3653","_links":{"self":{"href":"https://api.github.com/repos/aspnet/EntityFramework/pulls/comments/43950881"},"html":{"href":"https://github.com/aspnet/EntityFramework/pull/3653#discussion_r43950881"},"pull_request":{"href":"https://api.github.com/repos/aspnet/EntityFramework/pulls/3653"}}},"pull_request":{"url":"https://api.github.com/repos/aspnet/EntityFramework/pulls/3653","id":49652192,"html_url":"https://github.com/aspnet/EntityFramework/pull/3653","diff_url":"https://github.com/aspnet/EntityFramework/pull/3653.diff","patch_url":"https://github.com/aspnet/EntityFramework/pull/3653.patch","issue_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/3653","number":3653,"state":"open","locked":false,"title":"Query: Perf improvements to query annotations.","user":{"login":"anpete","id":1210944,"avatar_url":"https://avatars.githubusercontent.com/u/1210944?v=3","gravatar_id":"","url":"https://api.github.com/users/anpete","html_url":"https://github.com/anpete","followers_url":"https://api.github.com/users/anpete/followers","following_url":"https://api.github.com/users/anpete/following{/other_user}","gists_url":"https://api.github.com/users/anpete/gists{/gist_id}","starred_url":"https://api.github.com/users/anpete/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anpete/subscriptions","organizations_url":"https://api.github.com/users/anpete/orgs","repos_url":"https://api.github.com/users/anpete/repos","events_url":"https://api.github.com/users/anpete/events{/privacy}","received_events_url":"https://api.github.com/users/anpete/received_events","type":"User","site_admin":false},"body":"- Use Result Operators for query annotations. Avoids an ET rewrite during query cache resolution.\r\n- FromSql queries correctly handled in query cache.\r\n- Fixed some issues with null semantics processing. Always do null semantics rewriting during SQL gen.\r\n- Streamlined and standardized some ET visitor code.","created_at":"2015-11-04T06:14:08Z","updated_at":"2015-11-04T22:37:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"174fd737178b955da7e69c1bf925cc4db0408de8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/aspnet/EntityFramework/pulls/3653/commits","review_comments_url":"https://api.github.com/repos/aspnet/EntityFramework/pulls/3653/comments","review_comment_url":"https://api.github.com/repos/aspnet/EntityFramework/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/3653/comments","statuses_url":"https://api.github.com/repos/aspnet/EntityFramework/statuses/2e16c3ad19fbb2c721dfe8e8baad9e1774446f99","head":{"label":"aspnet:query-annotations","ref":"query-annotations","sha":"2e16c3ad19fbb2c721dfe8e8baad9e1774446f99","user":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"repo":{"id":16157746,"name":"EntityFramework","full_name":"aspnet/EntityFramework","owner":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aspnet/EntityFramework","description":"Microsoft's recommended data access technology for new applications in .NET.","fork":false,"url":"https://api.github.com/repos/aspnet/EntityFramework","forks_url":"https://api.github.com/repos/aspnet/EntityFramework/forks","keys_url":"https://api.github.com/repos/aspnet/EntityFramework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aspnet/EntityFramework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aspnet/EntityFramework/teams","hooks_url":"https://api.github.com/repos/aspnet/EntityFramework/hooks","issue_events_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/events{/number}","events_url":"https://api.github.com/repos/aspnet/EntityFramework/events","assignees_url":"https://api.github.com/repos/aspnet/EntityFramework/assignees{/user}","branches_url":"https://api.github.com/repos/aspnet/EntityFramework/branches{/branch}","tags_url":"https://api.github.com/repos/aspnet/EntityFramework/tags","blobs_url":"https://api.github.com/repos/aspnet/EntityFramework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aspnet/EntityFramework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aspnet/EntityFramework/git/refs{/sha}","trees_url":"https://api.github.com/repos/aspnet/EntityFramework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aspnet/EntityFramework/statuses/{sha}","languages_url":"https://api.github.com/repos/aspnet/EntityFramework/languages","stargazers_url":"https://api.github.com/repos/aspnet/EntityFramework/stargazers","contributors_url":"https://api.github.com/repos/aspnet/EntityFramework/contributors","subscribers_url":"https://api.github.com/repos/aspnet/EntityFramework/subscribers","subscription_url":"https://api.github.com/repos/aspnet/EntityFramework/subscription","commits_url":"https://api.github.com/repos/aspnet/EntityFramework/commits{/sha}","git_commits_url":"https://api.github.com/repos/aspnet/EntityFramework/git/commits{/sha}","comments_url":"https://api.github.com/repos/aspnet/EntityFramework/comments{/number}","issue_comment_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/comments{/number}","contents_url":"https://api.github.com/repos/aspnet/EntityFramework/contents/{+path}","compare_url":"https://api.github.com/repos/aspnet/EntityFramework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aspnet/EntityFramework/merges","archive_url":"https://api.github.com/repos/aspnet/EntityFramework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aspnet/EntityFramework/downloads","issues_url":"https://api.github.com/repos/aspnet/EntityFramework/issues{/number}","pulls_url":"https://api.github.com/repos/aspnet/EntityFramework/pulls{/number}","milestones_url":"https://api.github.com/repos/aspnet/EntityFramework/milestones{/number}","notifications_url":"https://api.github.com/repos/aspnet/EntityFramework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aspnet/EntityFramework/labels{/name}","releases_url":"https://api.github.com/repos/aspnet/EntityFramework/releases{/id}","created_at":"2014-01-23T00:52:01Z","updated_at":"2015-11-04T20:14:56Z","pushed_at":"2015-11-04T18:30:39Z","git_url":"git://github.com/aspnet/EntityFramework.git","ssh_url":"git@github.com:aspnet/EntityFramework.git","clone_url":"https://github.com/aspnet/EntityFramework.git","svn_url":"https://github.com/aspnet/EntityFramework","homepage":"","size":119168,"stargazers_count":2440,"watchers_count":2440,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":708,"mirror_url":null,"open_issues_count":477,"forks":708,"open_issues":477,"watchers":2440,"default_branch":"dev"}},"base":{"label":"aspnet:dev","ref":"dev","sha":"23006fce1c3b6efdaf21ed083e3b1bbf1509c540","user":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"repo":{"id":16157746,"name":"EntityFramework","full_name":"aspnet/EntityFramework","owner":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aspnet/EntityFramework","description":"Microsoft's recommended data access technology for new applications in .NET.","fork":false,"url":"https://api.github.com/repos/aspnet/EntityFramework","forks_url":"https://api.github.com/repos/aspnet/EntityFramework/forks","keys_url":"https://api.github.com/repos/aspnet/EntityFramework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aspnet/EntityFramework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aspnet/EntityFramework/teams","hooks_url":"https://api.github.com/repos/aspnet/EntityFramework/hooks","issue_events_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/events{/number}","events_url":"https://api.github.com/repos/aspnet/EntityFramework/events","assignees_url":"https://api.github.com/repos/aspnet/EntityFramework/assignees{/user}","branches_url":"https://api.github.com/repos/aspnet/EntityFramework/branches{/branch}","tags_url":"https://api.github.com/repos/aspnet/EntityFramework/tags","blobs_url":"https://api.github.com/repos/aspnet/EntityFramework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aspnet/EntityFramework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aspnet/EntityFramework/git/refs{/sha}","trees_url":"https://api.github.com/repos/aspnet/EntityFramework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aspnet/EntityFramework/statuses/{sha}","languages_url":"https://api.github.com/repos/aspnet/EntityFramework/languages","stargazers_url":"https://api.github.com/repos/aspnet/EntityFramework/stargazers","contributors_url":"https://api.github.com/repos/aspnet/EntityFramework/contributors","subscribers_url":"https://api.github.com/repos/aspnet/EntityFramework/subscribers","subscription_url":"https://api.github.com/repos/aspnet/EntityFramework/subscription","commits_url":"https://api.github.com/repos/aspnet/EntityFramework/commits{/sha}","git_commits_url":"https://api.github.com/repos/aspnet/EntityFramework/git/commits{/sha}","comments_url":"https://api.github.com/repos/aspnet/EntityFramework/comments{/number}","issue_comment_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/comments{/number}","contents_url":"https://api.github.com/repos/aspnet/EntityFramework/contents/{+path}","compare_url":"https://api.github.com/repos/aspnet/EntityFramework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aspnet/EntityFramework/merges","archive_url":"https://api.github.com/repos/aspnet/EntityFramework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aspnet/EntityFramework/downloads","issues_url":"https://api.github.com/repos/aspnet/EntityFramework/issues{/number}","pulls_url":"https://api.github.com/repos/aspnet/EntityFramework/pulls{/number}","milestones_url":"https://api.github.com/repos/aspnet/EntityFramework/milestones{/number}","notifications_url":"https://api.github.com/repos/aspnet/EntityFramework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aspnet/EntityFramework/labels{/name}","releases_url":"https://api.github.com/repos/aspnet/EntityFramework/releases{/id}","created_at":"2014-01-23T00:52:01Z","updated_at":"2015-11-04T20:14:56Z","pushed_at":"2015-11-04T18:30:39Z","git_url":"git://github.com/aspnet/EntityFramework.git","ssh_url":"git@github.com:aspnet/EntityFramework.git","clone_url":"https://github.com/aspnet/EntityFramework.git","svn_url":"https://github.com/aspnet/EntityFramework","homepage":"","size":119168,"stargazers_count":2440,"watchers_count":2440,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":708,"mirror_url":null,"open_issues_count":477,"forks":708,"open_issues":477,"watchers":2440,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/aspnet/EntityFramework/pulls/3653"},"html":{"href":"https://github.com/aspnet/EntityFramework/pull/3653"},"issue":{"href":"https://api.github.com/repos/aspnet/EntityFramework/issues/3653"},"comments":{"href":"https://api.github.com/repos/aspnet/EntityFramework/issues/3653/comments"},"review_comments":{"href":"https://api.github.com/repos/aspnet/EntityFramework/pulls/3653/comments"},"review_comment":{"href":"https://api.github.com/repos/aspnet/EntityFramework/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aspnet/EntityFramework/pulls/3653/commits"},"statuses":{"href":"https://api.github.com/repos/aspnet/EntityFramework/statuses/2e16c3ad19fbb2c721dfe8e8baad9e1774446f99"}}}}