-
Notifications
You must be signed in to change notification settings - Fork 499
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
RID missing for cross partition subquery with select clause. #375
Comments
Is it anyway related to Azure/azure-cosmos-dotnet-v2#717 |
Hi @jcocchi, this is not related to #3608 . This issue is four years old at this point. @simplynaveen20 , can you reproduce in the latest version of the v3 sdk ? |
Hi @neildsh, I'm getting the same issue when using a similar query as the one in the original post with v3.36.0 of the sdk. The query I'm using looks something like this (names changed for confidentiality reasons) public record class Test
{
public string Id { get; set; }
public List<string> A { get; set; }
public List<Test2> B { get; set; }
public int C { get; set; }
public int D { get; set; }
}
public record class Test2
{
public string L { get; set; }
}
container.GetLinqItemQueryable<Test>()
.Select(t => new Test()
{
Id = t.Id,
A = t.A,
B = t.B.Select(b => new Test2()
{
L = b.L
}).Where(b => t.A.Contains(b.L)).ToList()
})
.OrderByDescending(t => t.C).ThenByDescendng(t => t.D)
.Take(500); And the query definition: SELECT TOP 500 VALUE r1
FROM
(
SELECT VALUE {"id": root["id"], "a": root["a"], "b": v0}
FROM root
JOIN
(
SELECT VALUE ARRAY(
SELECT VALUE {"l": l0["l"]} FROM root
JOIN l0 IN root["b"]
WHERE ARRAY_CONTAINS(root["a"], {"l": l0["l"]}["l"])
)
) AS v0
) AS r1
ORDER BY r1["c"] DESC, r1["d"] DESC |
RID missing in the response for cross partition subquery with select clause.
We are getting exception of null RID in OrderByQueryResult while running select subquery clause with orderby using LINQ
Code for repro
################################################
public class ToDoActivity
{
public string id { get; set; }
public int taskNum { get; set; }
public double cost { get; set; }
public string description { get; set; }
public string status { get; set; }
public List children { get; set; }
}
OrderedQueryable linqQueryable = this.Container.CreateItemQuery(allowSynchronousQueryExecution: true);
IQueryable queriableOrderTest = linqQueryable
.Select(f => new { f.id, f.children , SmartChildren = f.children.Where(c => c.taskNum > 42)})
.OrderBy(f => f.id);
List list = queriableOrderTest.ToList();
###############################################
Query getting generated =
"SELECT r0._rid, [{"item": r0["id"]}] AS orderByItems, r0 AS payload
FROM
(SELECT VALUE {"id": root["id"], "children": root["children"], "SmartChildren": v0}
FROM root
JOIN
(SELECT VALUE ARRAY(SELECT VALUE c0
FROM root
JOIN c0 IN root["children"]
WHERE (c0["taskNum"] > 42))
)
AS v0)
AS r0
WHERE ((true) AND IS_DEFINED(r0))
ORDER BY r0["id"] ASC"
Expected behavior
We should able to get the response without exception
Actual behavior
Getting exception when code try to fetch RID in OrderByQueryResult
SDK Version: V3
The text was updated successfully, but these errors were encountered: