-
Notifications
You must be signed in to change notification settings - Fork 477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Query: Adds support for multi-value Group By query for LINQ #4481
base: master
Are you sure you want to change the base?
Conversation
Semi-related issues in case they are easy to address in the same block of work:
|
JOIN value IN root)) AS v2 | ||
GROUP BY root["id"] | ||
]]></SqlQuery> | ||
<ErrorMessage><![CDATA[Status Code: BadRequest,{"errors":[{"severity":"Error","location":{"start":129,"end":134},"code":"SC1001","message":"Syntax error, incorrect syntax near 'value'."}]},0x800A0B00]]></ErrorMessage> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to indicate invalid query is being generated?
<SqlQuery><![CDATA[]]></SqlQuery> | ||
<ErrorMessage><![CDATA[Expression with NodeType 'New' is not supported.]]></ErrorMessage> | ||
<SqlQuery><![CDATA[ | ||
SELECT root["FamilyId"] AS familyId, ARRAY_LENGTH(root) AS familyIdCount |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JOIN v2 IN root)) AS v3 | ||
GROUP BY root["id"] | ||
]]></SqlQuery> | ||
<ErrorMessage><![CDATA[Status Code: BadRequest,{"errors":[{"severity":"Error","location":{"start":7,"end":9},"code":"SC2102","message":"Property reference 'v1' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause."},{"severity":"Error","location":{"start":21,"end":23},"code":"SC2102","message":"Property reference 'v3' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause."}]},0x800A0B00]]></ErrorMessage> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as before. Seems like invalid query is being generated?
ORDER BY f["FamilyId"] ASC)) AS v1 | ||
GROUP BY root["id"] | ||
]]></SqlQuery> | ||
<ErrorMessage><![CDATA[Status Code: BadRequest,{"errors":[{"severity":"Error","location":{"start":93,"end":98},"code":"SC1001","message":"Syntax error, incorrect syntax near 'value'."}]},0x800A0B00]]></ErrorMessage> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Invalid query?
...ests/BaselineTest/TestBaseline/LinqGeneralBaselineTests.TestGroupByMultiValueTranslation.xml
Show resolved
Hide resolved
<SqlQuery><![CDATA[]]></SqlQuery> | ||
<ErrorMessage><![CDATA[Expression with NodeType 'New' is not supported.]]></ErrorMessage> | ||
<SqlQuery><![CDATA[ | ||
SELECT r0 AS keyAlias, ARRAY_LENGTH(r0) AS count |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...ests/BaselineTest/TestBaseline/LinqGeneralBaselineTests.TestGroupByMultiValueTranslation.xml
Show resolved
Hide resolved
...ests/BaselineTest/TestBaseline/LinqGeneralBaselineTests.TestGroupByMultiValueTranslation.xml
Show resolved
Hide resolved
...ests/BaselineTest/TestBaseline/LinqGeneralBaselineTests.TestGroupByMultiValueTranslation.xml
Show resolved
Hide resolved
...oft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Linq/LinqGeneralBaselineTests.cs
Outdated
Show resolved
Hide resolved
Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Linq/LinqTestsCommon.cs
Outdated
Show resolved
Hide resolved
...oft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Linq/LinqGeneralBaselineTests.cs
Outdated
Show resolved
Hide resolved
Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Linq/LinqTestsCommon.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🕐
throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.ExpressionTypeIsNotSupported, ExpressionType.New)); | ||
break; | ||
} | ||
case ExpressionType.New: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not able to make the 1:1 connection between new expression and multi-value group by.
IOW, it's not clear why every new expression here is a multi-value GROUP BY and vice-versa. #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's group by syntax as defined by LINQ
https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.groupby?view=net-8.0
Pull Request Template
Description
This PR adds the ability to translate LINQ query to SQL query with multiple items in the SQL select clause. This is achieved through the value clause using NewExpression
Type of change
Please delete options that are not relevant.
Closing issues
To automatically close an issue: closes #IssueNumber