Skip to content
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

Better cast/convert support for Cosmos #35000

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix some missed tests
ChrisJollyAU committed Feb 11, 2025
commit f609f0769e7e532b2a760323cb9c56e2d6afad67
Original file line number Diff line number Diff line change
@@ -91,6 +91,12 @@ protected virtual void AddTranslationErrorDetails(string details)

if (result is SqlExpression translation)
{
if (translation is SqlUnaryExpression { OperatorType: ExpressionType.Convert } sqlUnaryExpression
&& sqlUnaryExpression.Type == typeof(object))
{
translation = sqlUnaryExpression.Operand;
}

if (applyDefaultTypeMapping)
{
translation = sqlExpressionFactory.ApplyDefaultTypeMapping(translation);
Original file line number Diff line number Diff line change
@@ -1581,11 +1581,9 @@ public override Task Decimal_cast_to_double_works(bool async)

AssertSql(
"""
@i='10'

SELECT VALUE c["id"]
SELECT VALUE c
FROM root c
WHERE (((ToString(@i) || c["id"]) || ToString(@i)) = "10ALFKI10")
WHERE ((c["$type"] = "Product") AND (c["UnitPrice"] > 100.0))
""");
});

@@ -1597,12 +1595,9 @@ public override Task Where_is_conditional(bool async)

AssertSql(
"""
@p='11'
@p0='12'

SELECT VALUE c
FROM root c
WHERE (((c["id"] || ToString(@p)) || (c["id"] || ToString(@p0))) = "ALFKI11ALFKI12")
WHERE ((c["$type"] = "Product") AND (true ? false : true))
""");
});