From c983055476e69947e86b0ada1e302a1d4c0f498c Mon Sep 17 00:00:00 2001 From: Ernesto Cortes Groman Date: Thu, 26 Jan 2023 19:07:48 -0800 Subject: [PATCH 1/9] string.Compare supported with LINQ to SQL --- .../src/Linq/ExpressionToSQL.cs | 74 +++++ ...nBaselineTests.TestStringCompareStatic.xml | 257 ++++++++++++++++++ .../LinqTranslationBaselineTests.cs | 50 ++++ ...icrosoft.Azure.Cosmos.EmulatorTests.csproj | 3 + 4 files changed, 384 insertions(+) create mode 100644 Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringCompareStatic.xml diff --git a/Microsoft.Azure.Cosmos/src/Linq/ExpressionToSQL.cs b/Microsoft.Azure.Cosmos/src/Linq/ExpressionToSQL.cs index d15f67fece..98d72d4fe4 100644 --- a/Microsoft.Azure.Cosmos/src/Linq/ExpressionToSQL.cs +++ b/Microsoft.Azure.Cosmos/src/Linq/ExpressionToSQL.cs @@ -458,6 +458,10 @@ private static SqlScalarExpression VisitBinary(BinaryExpression inputExpression, { return ExpressionToSql.VisitStringCompareTo(methodCallExpression, constantExpression, inputExpression.NodeType, reverseNodeType, context); } + if (TryMatchStringCompare(methodCallExpression, constantExpression, inputExpression.NodeType)) + { + return ExpressionToSql.VisitStringCompare(methodCallExpression, constantExpression, inputExpression.NodeType, reverseNodeType, context); + } } SqlScalarExpression left = ExpressionToSql.VisitScalarExpression(inputExpression.Left, context); @@ -646,6 +650,76 @@ private static SqlScalarExpression VisitStringCompareTo( return SqlBinaryScalarExpression.Create(op, leftExpression, rightExpression); } + private static bool TryMatchStringCompare(MethodCallExpression left, ConstantExpression right, ExpressionType compareOperator) + { + if (left.Method.Equals(typeof(string).GetMethod("Compare", new Type[] { typeof(string), typeof(string) })) && left.Arguments.Count == 2) + { + // operator can only be =, >, >=, <, <= + switch (compareOperator) + { + case ExpressionType.Equal: + case ExpressionType.GreaterThan: + case ExpressionType.GreaterThanOrEqual: + case ExpressionType.LessThan: + case ExpressionType.LessThanOrEqual: + break; + default: + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.StringCompareToInvalidOperator)); + } + + // the constant value should be zero, otherwise we can't determine how to translate the expression + // it could be either integer or nullable integer + if (!(right.Type == typeof(int) && (int)right.Value == 0) && + !(right.Type == typeof(int?) && ((int?)right.Value).HasValue && ((int?)right.Value).Value == 0)) + { + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.StringCompareToInvalidConstant)); + } + + return true; + } + + return false; + } + + private static SqlScalarExpression VisitStringCompare( + MethodCallExpression left, + ConstantExpression right, + ExpressionType compareOperator, + bool reverseNodeType, + TranslationContext context) + { + if (reverseNodeType) + { + switch (compareOperator) + { + case ExpressionType.Equal: + // do nothing + break; + case ExpressionType.GreaterThan: + compareOperator = ExpressionType.LessThan; + break; + case ExpressionType.GreaterThanOrEqual: + compareOperator = ExpressionType.LessThanOrEqual; + break; + case ExpressionType.LessThan: + compareOperator = ExpressionType.GreaterThan; + break; + case ExpressionType.LessThanOrEqual: + compareOperator = ExpressionType.GreaterThanOrEqual; + break; + default: + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.StringCompareToInvalidOperator)); + } + } + + SqlBinaryScalarOperatorKind op = GetBinaryOperatorKind(compareOperator, null); + + SqlScalarExpression leftExpression = ExpressionToSql.VisitNonSubqueryScalarExpression(left.Arguments[0], context); + SqlScalarExpression rightExpression = ExpressionToSql.VisitNonSubqueryScalarExpression(left.Arguments[1], context); + + return SqlBinaryScalarExpression.Create(op, leftExpression, rightExpression); + } + private static SqlScalarExpression VisitTypeIs(TypeBinaryExpression inputExpression, TranslationContext context) { throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.ExpressionTypeIsNotSupported, inputExpression.NodeType)); diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringCompareStatic.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringCompareStatic.xml new file mode 100644 index 0000000000..d7df277ece --- /dev/null +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringCompareStatic.xml @@ -0,0 +1,257 @@ + + + + + (Compare(doc.StringField, doc.StringField2) == 0))]]> + + + + + + + + + + ]]> + (Compare(doc.StringField, doc.StringField2) > 0))]]> + + + + root["StringField2"]) +FROM root]]> + + + + + + =]]> + (Compare(doc.StringField, doc.StringField2) >= 0))]]> + + + + = root["StringField2"]) +FROM root]]> + + + + + + + (Compare(doc.StringField, doc.StringField2) < 0))]]> + + + + + + + + + + + (Compare(doc.StringField, doc.StringField2) <= 0))]]> + + + + + + + + + + + (Compare(doc.StringField, "str") == 0))]]> + + + + + + + + + + ]]> + (Compare(doc.StringField, "str") > 0))]]> + + + + "str") +FROM root]]> + + + + + + =]]> + (Compare(doc.StringField, "str") >= 0))]]> + + + + = "str") +FROM root]]> + + + + + + + (Compare(doc.StringField, "str") < 0))]]> + + + + + + + + + + + (Compare(doc.StringField, "str") <= 0))]]> + + + + + + + + + + + (0 == Compare(doc.StringField, doc.StringField2)))]]> + + + + + + + + + + + (0 < Compare(doc.StringField, doc.StringField2)))]]> + + + + root["StringField2"]) +FROM root]]> + + + + + + + (0 <= Compare(doc.StringField, doc.StringField2)))]]> + + + + = root["StringField2"]) +FROM root]]> + + + + + + reverse operands]]> + (0 > Compare(doc.StringField, doc.StringField2)))]]> + + + + + + + + + + = reverse operands]]> + (0 >= Compare(doc.StringField, doc.StringField2)))]]> + + + + + + + + + + 1]]> + (Compare(doc.StringField, "str") > 1))]]> + + + + + + + + + + (Compare(doc.StringField, "str") == 1))]]> + + + + + + + + + + (Compare(doc.StringField, "str") == -1))]]> + + + + + + + + + + (Compare(doc.StringField, "str") | 0))]]> + + + + ' or '>=')]]> + + + + + + (Compare(doc.StringField, "str") & 0))]]> + + + + ' or '>=')]]> + + + + + + (Compare(doc.StringField, "str") ^ 0))]]> + + + + ' or '>=')]]> + + + \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/LinqTranslationBaselineTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/LinqTranslationBaselineTests.cs index 67a4aa9364..5b733e3e08 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/LinqTranslationBaselineTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/LinqTranslationBaselineTests.cs @@ -1015,6 +1015,56 @@ public void TestStringCompareTo() this.ExecuteTestSuite(inputs); } + [TestMethod] + public void TestStringCompareStatic() + { + IOrderedQueryable testQuery = testContainer.GetItemLinqQueryable(allowSynchronousQueryExecution: true); + + const int Records = 100; + const int MaxStringLength = 20; + Func createDataObj = (random) => + { + DataObject obj = new DataObject(); + obj.StringField = LinqTestsCommon.RandomString(random, random.Next(MaxStringLength)); + obj.StringField2 = random.NextDouble() < 0.5 ? obj.StringField : LinqTestsCommon.RandomString(random, random.Next(MaxStringLength)); + obj.Id = Guid.NewGuid().ToString(); + obj.Pk = "Test"; + return obj; + }; + Func> getQuery = LinqTestsCommon.GenerateTestCosmosData(createDataObj, Records, testContainer); + + List inputs = new List + { + // projected compare + new LinqTestInput("Projected Compare ==", b => getQuery(b).Select(doc => String.Compare(doc.StringField, doc.StringField2) == 0)), + new LinqTestInput("Projected Compare >", b => getQuery(b).Select(doc => String.Compare(doc.StringField, doc.StringField2) > 0)), + new LinqTestInput("Projected Compare >=", b => getQuery(b).Select(doc => String.Compare(doc.StringField, doc.StringField2) >= 0)), + new LinqTestInput("Projected Compare <", b => getQuery(b).Select(doc => String.Compare(doc.StringField, doc.StringField2) < 0)), + new LinqTestInput("Projected Compare <=", b => getQuery(b).Select(doc => String.Compare(doc.StringField, doc.StringField2) <= 0)), + // static strings + new LinqTestInput("Compare static string ==", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") == 0)), + new LinqTestInput("Compare static string >", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") > 0)), + new LinqTestInput("Compare static string >=", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") >= 0)), + new LinqTestInput("Compare static string <", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") < 0)), + new LinqTestInput("Compare static string <=", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") <= 0)), + // reverse operands + new LinqTestInput("Projected Compare == reverse operands", b => getQuery(b).Select(doc => 0 == String.Compare(doc.StringField, doc.StringField2))), + new LinqTestInput("Projected Compare < reverse operands", b => getQuery(b).Select(doc => 0 < String.Compare(doc.StringField, doc.StringField2))), + new LinqTestInput("Projected Compare <= reverse operands", b => getQuery(b).Select(doc => 0 <= String.Compare(doc.StringField, doc.StringField2))), + new LinqTestInput("Projected Compare > reverse operands", b => getQuery(b).Select(doc => 0 > String.Compare(doc.StringField, doc.StringField2))), + new LinqTestInput("Projected Compare >= reverse operands", b => getQuery(b).Select(doc => 0 >= String.Compare(doc.StringField, doc.StringField2))), + // errors Invalid compare value + new LinqTestInput("Compare > 1", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") > 1)), + new LinqTestInput("Compare == 1", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") == 1)), + new LinqTestInput("Compare == -1", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") == -1)), + // errors Invalid operator + new LinqTestInput("Compare | 0", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") | 0)), + new LinqTestInput("Compare & 0", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") & 0)), + new LinqTestInput("Compare ^ 0", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") ^ 0)) + }; + this.ExecuteTestSuite(inputs); + } + [TestMethod] public void TestUDFs() { diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Microsoft.Azure.Cosmos.EmulatorTests.csproj b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Microsoft.Azure.Cosmos.EmulatorTests.csproj index 10e0462cef..6f14f491fd 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Microsoft.Azure.Cosmos.EmulatorTests.csproj +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Microsoft.Azure.Cosmos.EmulatorTests.csproj @@ -299,6 +299,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest From e25b81479795df7a81f59833bd304a09f62008a0 Mon Sep 17 00:00:00 2001 From: Ernesto Cortes Groman Date: Wed, 14 Jun 2023 12:05:38 -0700 Subject: [PATCH 2/9] Update tests --- ...nBaselineTests.TestStringCompareStatic.xml | 96 +++++++++---------- .../LinqTranslationBaselineTests.cs | 22 ++--- 2 files changed, 59 insertions(+), 59 deletions(-) diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringCompareStatic.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringCompareStatic.xml index d7df277ece..7aebf764ff 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringCompareStatic.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringCompareStatic.xml @@ -2,12 +2,12 @@ - (Compare(doc.StringField, doc.StringField2) == 0))]]> + (String.Compare(doc.StringField, doc.StringField2) == 0))]]> @@ -15,12 +15,12 @@ FROM root]]> ]]> - (Compare(doc.StringField, doc.StringField2) > 0))]]> + (String.Compare(doc.StringField, doc.StringField2) > 0))]]> root["StringField2"]) +SELECT VALUE (root["StringField"] > root["StringField2"]) FROM root]]> @@ -28,12 +28,12 @@ FROM root]]> =]]> - (Compare(doc.StringField, doc.StringField2) >= 0))]]> + (String.Compare(doc.StringField, doc.StringField2) >= 0))]]> = root["StringField2"]) +SELECT VALUE (root["StringField"] >= root["StringField2"]) FROM root]]> @@ -41,12 +41,12 @@ FROM root]]> - (Compare(doc.StringField, doc.StringField2) < 0))]]> + (String.Compare(doc.StringField, doc.StringField2) < 0))]]> @@ -54,12 +54,12 @@ FROM root]]> - (Compare(doc.StringField, doc.StringField2) <= 0))]]> + (String.Compare(doc.StringField, doc.StringField2) <= 0))]]> @@ -67,12 +67,12 @@ FROM root]]> - (Compare(doc.StringField, "str") == 0))]]> + (String.Compare(doc.StringField, "str") == 0))]]> @@ -80,12 +80,12 @@ FROM root]]> ]]> - (Compare(doc.StringField, "str") > 0))]]> + (String.Compare(doc.StringField, "str") > 0))]]> "str") +SELECT VALUE (root["StringField"] > "str") FROM root]]> @@ -93,12 +93,12 @@ FROM root]]> =]]> - (Compare(doc.StringField, "str") >= 0))]]> + (String.Compare(doc.StringField, "str") >= 0))]]> = "str") +SELECT VALUE (root["StringField"] >= "str") FROM root]]> @@ -106,12 +106,12 @@ FROM root]]> - (Compare(doc.StringField, "str") < 0))]]> + (String.Compare(doc.StringField, "str") < 0))]]> @@ -119,12 +119,12 @@ FROM root]]> - (Compare(doc.StringField, "str") <= 0))]]> + (String.Compare(doc.StringField, "str") <= 0))]]> @@ -132,12 +132,12 @@ FROM root]]> - (0 == Compare(doc.StringField, doc.StringField2)))]]> + (0 == String.Compare(doc.StringField, doc.StringField2)))]]> @@ -145,12 +145,12 @@ FROM root]]> - (0 < Compare(doc.StringField, doc.StringField2)))]]> + (0 < String.Compare(doc.StringField, doc.StringField2)))]]> root["StringField2"]) +SELECT VALUE (root["StringField"] > root["StringField2"]) FROM root]]> @@ -158,12 +158,12 @@ FROM root]]> - (0 <= Compare(doc.StringField, doc.StringField2)))]]> + (0 <= String.Compare(doc.StringField, doc.StringField2)))]]> = root["StringField2"]) +SELECT VALUE (root["StringField"] >= root["StringField2"]) FROM root]]> @@ -171,12 +171,12 @@ FROM root]]> reverse operands]]> - (0 > Compare(doc.StringField, doc.StringField2)))]]> + (0 > String.Compare(doc.StringField, doc.StringField2)))]]> @@ -184,74 +184,74 @@ FROM root]]> = reverse operands]]> - (0 >= Compare(doc.StringField, doc.StringField2)))]]> + (0 >= String.Compare(doc.StringField, doc.StringField2)))]]> - 1]]> - (Compare(doc.StringField, "str") > 1))]]> + 1]]> + (String.Compare(doc.StringField, "str") > 1))]]> - + - - (Compare(doc.StringField, "str") == 1))]]> + + (String.Compare(doc.StringField, "str") == 1))]]> - + - - (Compare(doc.StringField, "str") == -1))]]> + + (String.Compare(doc.StringField, "str") == -1))]]> - + - - (Compare(doc.StringField, "str") | 0))]]> + + (String.Compare(doc.StringField, "str") | 0))]]> - ' or '>=')]]> + ' or '>=')]]> - - (Compare(doc.StringField, "str") & 0))]]> + + (String.Compare(doc.StringField, "str") & 0))]]> - ' or '>=')]]> + ' or '>=')]]> - - (Compare(doc.StringField, "str") ^ 0))]]> + + (String.Compare(doc.StringField, "str") ^ 0))]]> - ' or '>=')]]> + ' or '>=')]]> \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/LinqTranslationBaselineTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/LinqTranslationBaselineTests.cs index ec66b21d59..b79956a3ba 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/LinqTranslationBaselineTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/LinqTranslationBaselineTests.cs @@ -1071,11 +1071,11 @@ public void TestStringCompareStatic() new LinqTestInput("Projected Compare <", b => getQuery(b).Select(doc => String.Compare(doc.StringField, doc.StringField2) < 0)), new LinqTestInput("Projected Compare <=", b => getQuery(b).Select(doc => String.Compare(doc.StringField, doc.StringField2) <= 0)), // static strings - new LinqTestInput("Compare static string ==", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") == 0)), - new LinqTestInput("Compare static string >", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") > 0)), - new LinqTestInput("Compare static string >=", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") >= 0)), - new LinqTestInput("Compare static string <", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") < 0)), - new LinqTestInput("Compare static string <=", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") <= 0)), + new LinqTestInput("String.Compare static string ==", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") == 0)), + new LinqTestInput("String.Compare static string >", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") > 0)), + new LinqTestInput("String.Compare static string >=", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") >= 0)), + new LinqTestInput("String.Compare static string <", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") < 0)), + new LinqTestInput("String.Compare static string <=", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") <= 0)), // reverse operands new LinqTestInput("Projected Compare == reverse operands", b => getQuery(b).Select(doc => 0 == String.Compare(doc.StringField, doc.StringField2))), new LinqTestInput("Projected Compare < reverse operands", b => getQuery(b).Select(doc => 0 < String.Compare(doc.StringField, doc.StringField2))), @@ -1083,13 +1083,13 @@ public void TestStringCompareStatic() new LinqTestInput("Projected Compare > reverse operands", b => getQuery(b).Select(doc => 0 > String.Compare(doc.StringField, doc.StringField2))), new LinqTestInput("Projected Compare >= reverse operands", b => getQuery(b).Select(doc => 0 >= String.Compare(doc.StringField, doc.StringField2))), // errors Invalid compare value - new LinqTestInput("Compare > 1", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") > 1)), - new LinqTestInput("Compare == 1", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") == 1)), - new LinqTestInput("Compare == -1", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") == -1)), + new LinqTestInput("String.Compare > 1", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") > 1)), + new LinqTestInput("String.Compare == 1", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") == 1)), + new LinqTestInput("String.Compare == -1", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") == -1)), // errors Invalid operator - new LinqTestInput("Compare | 0", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") | 0)), - new LinqTestInput("Compare & 0", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") & 0)), - new LinqTestInput("Compare ^ 0", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") ^ 0)) + new LinqTestInput("String.Compare | 0", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") | 0)), + new LinqTestInput("String.Compare & 0", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") & 0)), + new LinqTestInput("String.Compare ^ 0", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") ^ 0)) }; this.ExecuteTestSuite(inputs); } From 3ae9b0ed75df414d971d2d0a53617ec06b11d590 Mon Sep 17 00:00:00 2001 From: Ernesto Cortes Groman Date: Wed, 14 Jun 2023 12:13:03 -0700 Subject: [PATCH 3/9] Update test name --- .../LinqTranslationBaselineTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/LinqTranslationBaselineTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/LinqTranslationBaselineTests.cs index b79956a3ba..3eb493cad2 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/LinqTranslationBaselineTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/LinqTranslationBaselineTests.cs @@ -1045,7 +1045,7 @@ public void TestStringCompareTo() } [TestMethod] - public void TestStringCompareStatic() + public void TestStringCompare() { IOrderedQueryable testQuery = testContainer.GetItemLinqQueryable(allowSynchronousQueryExecution: true); From 8236ec2ac6791cbbfe387266e31f14f9d4aa2c86 Mon Sep 17 00:00:00 2001 From: Ernesto Cortes Groman Date: Wed, 14 Jun 2023 14:12:21 -0700 Subject: [PATCH 4/9] Update tests --- .../src/ClientResources.Designer.cs | 18 ++++++ .../src/ClientResources.resx | 6 ++ .../src/Linq/ExpressionToSQL.cs | 6 +- ...lationBaselineTests.TestStringCompare.xml} | 64 +++++++++---------- 4 files changed, 59 insertions(+), 35 deletions(-) rename Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/{LinqTranslationBaselineTests.TestStringCompareStatic.xml => LinqTranslationBaselineTests.TestStringCompare.xml} (62%) diff --git a/Microsoft.Azure.Cosmos/src/ClientResources.Designer.cs b/Microsoft.Azure.Cosmos/src/ClientResources.Designer.cs index 7ea2672d6c..3736d0fbbd 100644 --- a/Microsoft.Azure.Cosmos/src/ClientResources.Designer.cs +++ b/Microsoft.Azure.Cosmos/src/ClientResources.Designer.cs @@ -582,6 +582,24 @@ internal static string StringCompareToInvalidOperator { } } + /// + /// Looks up a localized string similar to Invalid operator for string.Compare(). Valid operators are ('==', '<', '<=', '>' or '>='). + /// + internal static string StringCompareInvalidOperator { + get { + return ResourceManager.GetString("StringCompareInvalidOperator", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The right hand side of string.Compare() comparison must be constant '0'. + /// + internal static string StringCompareInvalidConstant { + get { + return ResourceManager.GetString("StringCompareInvalidConstant", resourceCulture); + } + } + /// /// Looks up a localized string similar to Token refresh in progress.. /// diff --git a/Microsoft.Azure.Cosmos/src/ClientResources.resx b/Microsoft.Azure.Cosmos/src/ClientResources.resx index ae00e80a78..95b849cb01 100644 --- a/Microsoft.Azure.Cosmos/src/ClientResources.resx +++ b/Microsoft.Azure.Cosmos/src/ClientResources.resx @@ -270,9 +270,15 @@ The right hand side of string.CompareTo() comparison must be constant '0' + + The right hand side of string.Compare() comparison must be constant '0' + Invalid operator for string.CompareTo(). Vaid operators are ('==', '<', '<=', '>' or '>=') + + Invalid operator for string.Compare(). Vaid operators are ('==', '<', '<=', '>' or '>=') + Token refresh in progress. diff --git a/Microsoft.Azure.Cosmos/src/Linq/ExpressionToSQL.cs b/Microsoft.Azure.Cosmos/src/Linq/ExpressionToSQL.cs index df41cedfc6..c98363e36e 100644 --- a/Microsoft.Azure.Cosmos/src/Linq/ExpressionToSQL.cs +++ b/Microsoft.Azure.Cosmos/src/Linq/ExpressionToSQL.cs @@ -663,7 +663,7 @@ private static bool TryMatchStringCompare(MethodCallExpression left, ConstantExp case ExpressionType.LessThanOrEqual: break; default: - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.StringCompareToInvalidOperator)); + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.StringCompareInvalidOperator)); } // the constant value should be zero, otherwise we can't determine how to translate the expression @@ -671,7 +671,7 @@ private static bool TryMatchStringCompare(MethodCallExpression left, ConstantExp if (!(right.Type == typeof(int) && (int)right.Value == 0) && !(right.Type == typeof(int?) && ((int?)right.Value).HasValue && ((int?)right.Value).Value == 0)) { - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.StringCompareToInvalidConstant)); + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.StringCompareInvalidConstant)); } return true; @@ -707,7 +707,7 @@ private static SqlScalarExpression VisitStringCompare( compareOperator = ExpressionType.GreaterThanOrEqual; break; default: - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.StringCompareToInvalidOperator)); + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.StringCompareInvalidOperator)); } } diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringCompareStatic.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringCompare.xml similarity index 62% rename from Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringCompareStatic.xml rename to Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringCompare.xml index 7aebf764ff..bfe117849a 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringCompareStatic.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringCompare.xml @@ -2,7 +2,7 @@ - (String.Compare(doc.StringField, doc.StringField2) == 0))]]> + (Compare(doc.StringField, doc.StringField2) == 0))]]> @@ -15,7 +15,7 @@ FROM root]]> ]]> - (String.Compare(doc.StringField, doc.StringField2) > 0))]]> + (Compare(doc.StringField, doc.StringField2) > 0))]]> @@ -28,7 +28,7 @@ FROM root]]> =]]> - (String.Compare(doc.StringField, doc.StringField2) >= 0))]]> + (Compare(doc.StringField, doc.StringField2) >= 0))]]> @@ -41,7 +41,7 @@ FROM root]]> - (String.Compare(doc.StringField, doc.StringField2) < 0))]]> + (Compare(doc.StringField, doc.StringField2) < 0))]]> @@ -54,7 +54,7 @@ FROM root]]> - (String.Compare(doc.StringField, doc.StringField2) <= 0))]]> + (Compare(doc.StringField, doc.StringField2) <= 0))]]> @@ -66,8 +66,8 @@ FROM root]]> - - (String.Compare(doc.StringField, "str") == 0))]]> + + (Compare(doc.StringField, "str") == 0))]]> @@ -79,8 +79,8 @@ FROM root]]> - ]]> - (String.Compare(doc.StringField, "str") > 0))]]> + ]]> + (Compare(doc.StringField, "str") > 0))]]> @@ -92,8 +92,8 @@ FROM root]]> - =]]> - (String.Compare(doc.StringField, "str") >= 0))]]> + =]]> + (Compare(doc.StringField, "str") >= 0))]]> @@ -105,8 +105,8 @@ FROM root]]> - - (String.Compare(doc.StringField, "str") < 0))]]> + + (Compare(doc.StringField, "str") < 0))]]> @@ -118,8 +118,8 @@ FROM root]]> - - (String.Compare(doc.StringField, "str") <= 0))]]> + + (Compare(doc.StringField, "str") <= 0))]]> @@ -132,7 +132,7 @@ FROM root]]> - (0 == String.Compare(doc.StringField, doc.StringField2)))]]> + (0 == Compare(doc.StringField, doc.StringField2)))]]> @@ -145,7 +145,7 @@ FROM root]]> - (0 < String.Compare(doc.StringField, doc.StringField2)))]]> + (0 < Compare(doc.StringField, doc.StringField2)))]]> @@ -158,7 +158,7 @@ FROM root]]> - (0 <= String.Compare(doc.StringField, doc.StringField2)))]]> + (0 <= Compare(doc.StringField, doc.StringField2)))]]> @@ -171,7 +171,7 @@ FROM root]]> reverse operands]]> - (0 > String.Compare(doc.StringField, doc.StringField2)))]]> + (0 > Compare(doc.StringField, doc.StringField2)))]]> @@ -184,7 +184,7 @@ FROM root]]> = reverse operands]]> - (0 >= String.Compare(doc.StringField, doc.StringField2)))]]> + (0 >= Compare(doc.StringField, doc.StringField2)))]]> @@ -197,61 +197,61 @@ FROM root]]> 1]]> - (String.Compare(doc.StringField, "str") > 1))]]> + (Compare(doc.StringField, "str") > 1))]]> - + - (String.Compare(doc.StringField, "str") == 1))]]> + (Compare(doc.StringField, "str") == 1))]]> - + - (String.Compare(doc.StringField, "str") == -1))]]> + (Compare(doc.StringField, "str") == -1))]]> - + - (String.Compare(doc.StringField, "str") | 0))]]> + (Compare(doc.StringField, "str") | 0))]]> - ' or '>=')]]> + ' or '>=')]]> - (String.Compare(doc.StringField, "str") & 0))]]> + (Compare(doc.StringField, "str") & 0))]]> - ' or '>=')]]> + ' or '>=')]]> - (String.Compare(doc.StringField, "str") ^ 0))]]> + (Compare(doc.StringField, "str") ^ 0))]]> - ' or '>=')]]> + ' or '>=')]]> \ No newline at end of file From 1fd3fbae27ee7ab9b9dd2713dfd2c3ee33d550bf Mon Sep 17 00:00:00 2001 From: Ernesto Cortes Groman Date: Wed, 14 Jun 2023 14:36:58 -0700 Subject: [PATCH 5/9] Add test --- .../LinqTranslationBaselineTests.TestStringCompare.xml | 10 ++++++++++ .../LinqTranslationBaselineTests.cs | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringCompare.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringCompare.xml index bfe117849a..5343999af8 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringCompare.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringCompare.xml @@ -254,4 +254,14 @@ FROM root]]> ' or '>=')]]> + + + + (Compare(doc.StringField, 0, "str", 0, 3) == 0))]]> + + + + + + \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/LinqTranslationBaselineTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/LinqTranslationBaselineTests.cs index 3eb493cad2..62e296fad2 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/LinqTranslationBaselineTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/LinqTranslationBaselineTests.cs @@ -1089,7 +1089,9 @@ public void TestStringCompare() // errors Invalid operator new LinqTestInput("String.Compare | 0", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") | 0)), new LinqTestInput("String.Compare & 0", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") & 0)), - new LinqTestInput("String.Compare ^ 0", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") ^ 0)) + new LinqTestInput("String.Compare ^ 0", b => getQuery(b).Select(doc => String.Compare(doc.StringField, "str") ^ 0)), + // errors Unexpected number of arguments to string.Compare + new LinqTestInput("Unexpected number of arguments to string.Compare", b => getQuery(b).Select(doc => String.Compare(doc.StringField, 0, "str", 0, 3) == 0)) }; this.ExecuteTestSuite(inputs); } From 2ec00e5beaceb6353c34372cd98b47d6274d3362 Mon Sep 17 00:00:00 2001 From: Ernesto Cortes Groman Date: Wed, 14 Jun 2023 14:43:08 -0700 Subject: [PATCH 6/9] Create helper ReverseExpressionTypeForStrings --- .../src/Linq/ExpressionToSQL.cs | 68 ++++++++----------- 1 file changed, 28 insertions(+), 40 deletions(-) diff --git a/Microsoft.Azure.Cosmos/src/Linq/ExpressionToSQL.cs b/Microsoft.Azure.Cosmos/src/Linq/ExpressionToSQL.cs index c98363e36e..8b4f2f9d58 100644 --- a/Microsoft.Azure.Cosmos/src/Linq/ExpressionToSQL.cs +++ b/Microsoft.Azure.Cosmos/src/Linq/ExpressionToSQL.cs @@ -619,26 +619,7 @@ private static SqlScalarExpression VisitStringCompareTo( { if (reverseNodeType) { - switch (compareOperator) - { - case ExpressionType.Equal: - // do nothing - break; - case ExpressionType.GreaterThan: - compareOperator = ExpressionType.LessThan; - break; - case ExpressionType.GreaterThanOrEqual: - compareOperator = ExpressionType.LessThanOrEqual; - break; - case ExpressionType.LessThan: - compareOperator = ExpressionType.GreaterThan; - break; - case ExpressionType.LessThanOrEqual: - compareOperator = ExpressionType.GreaterThanOrEqual; - break; - default: - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.StringCompareToInvalidOperator)); - } + compareOperator = ReverseExpressionTypeForStrings(compareOperator, ClientResources.StringCompareToInvalidOperator); } SqlBinaryScalarOperatorKind op = GetBinaryOperatorKind(compareOperator, null); @@ -649,6 +630,32 @@ private static SqlScalarExpression VisitStringCompareTo( return SqlBinaryScalarExpression.Create(op, leftExpression, rightExpression); } + private static ExpressionType ReverseExpressionTypeForStrings(ExpressionType compareOperator, string errorMessage) + { + switch (compareOperator) + { + case ExpressionType.Equal: + // do nothing + break; + case ExpressionType.GreaterThan: + compareOperator = ExpressionType.LessThan; + break; + case ExpressionType.GreaterThanOrEqual: + compareOperator = ExpressionType.LessThanOrEqual; + break; + case ExpressionType.LessThan: + compareOperator = ExpressionType.GreaterThan; + break; + case ExpressionType.LessThanOrEqual: + compareOperator = ExpressionType.GreaterThanOrEqual; + break; + default: + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, errorMessage)); + } + + return compareOperator; + } + private static bool TryMatchStringCompare(MethodCallExpression left, ConstantExpression right, ExpressionType compareOperator) { if (left.Method.Equals(typeof(string).GetMethod("Compare", new Type[] { typeof(string), typeof(string) })) && left.Arguments.Count == 2) @@ -689,26 +696,7 @@ private static SqlScalarExpression VisitStringCompare( { if (reverseNodeType) { - switch (compareOperator) - { - case ExpressionType.Equal: - // do nothing - break; - case ExpressionType.GreaterThan: - compareOperator = ExpressionType.LessThan; - break; - case ExpressionType.GreaterThanOrEqual: - compareOperator = ExpressionType.LessThanOrEqual; - break; - case ExpressionType.LessThan: - compareOperator = ExpressionType.GreaterThan; - break; - case ExpressionType.LessThanOrEqual: - compareOperator = ExpressionType.GreaterThanOrEqual; - break; - default: - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.StringCompareInvalidOperator)); - } + compareOperator = ReverseExpressionTypeForStrings(compareOperator, ClientResources.StringCompareInvalidOperator); } SqlBinaryScalarOperatorKind op = GetBinaryOperatorKind(compareOperator, null); From 36a8f3de31102e1abb30ccd21da9248de0f38454 Mon Sep 17 00:00:00 2001 From: Ernesto Cortes Groman Date: Mon, 10 Jul 2023 10:07:13 -0700 Subject: [PATCH 7/9] PR feedback --- Microsoft.Azure.Cosmos/src/ClientResources.resx | 4 ++-- Microsoft.Azure.Cosmos/src/Linq/ExpressionToSQL.cs | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Microsoft.Azure.Cosmos/src/ClientResources.resx b/Microsoft.Azure.Cosmos/src/ClientResources.resx index 95b849cb01..7a3e336e2a 100644 --- a/Microsoft.Azure.Cosmos/src/ClientResources.resx +++ b/Microsoft.Azure.Cosmos/src/ClientResources.resx @@ -268,10 +268,10 @@ Failed to deserialize response returned by server. - The right hand side of string.CompareTo() comparison must be constant '0' + The right-hand side of String.CompareTo() comparison must be constant '0'. - The right hand side of string.Compare() comparison must be constant '0' + The right-hand side of String.Compare() comparison must be constant '0'. Invalid operator for string.CompareTo(). Vaid operators are ('==', '<', '<=', '>' or '>=') diff --git a/Microsoft.Azure.Cosmos/src/Linq/ExpressionToSQL.cs b/Microsoft.Azure.Cosmos/src/Linq/ExpressionToSQL.cs index 894adce3ba..2ada0738da 100644 --- a/Microsoft.Azure.Cosmos/src/Linq/ExpressionToSQL.cs +++ b/Microsoft.Azure.Cosmos/src/Linq/ExpressionToSQL.cs @@ -457,6 +457,7 @@ private static SqlScalarExpression VisitBinary(BinaryExpression inputExpression, { return ExpressionToSql.VisitStringCompareTo(methodCallExpression, constantExpression, inputExpression.NodeType, reverseNodeType, context); } + if (TryMatchStringCompare(methodCallExpression, constantExpression, inputExpression.NodeType)) { return ExpressionToSql.VisitStringCompare(methodCallExpression, constantExpression, inputExpression.NodeType, reverseNodeType, context); From 4b258201004d05c68123bbe3a8ead1af20681bd5 Mon Sep 17 00:00:00 2001 From: Ernesto Cortes Groman Date: Mon, 10 Jul 2023 16:00:06 -0700 Subject: [PATCH 8/9] Update tests --- .../LinqTranslationBaselineTests.TestStringCompare.xml | 6 +++--- .../LinqTranslationBaselineTests.TestStringCompareTo.xml | 6 +++--- .../Microsoft.Azure.Cosmos.EmulatorTests.csproj | 5 ++++- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringCompare.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringCompare.xml index 5343999af8..9e0b1b6b01 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringCompare.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringCompare.xml @@ -201,7 +201,7 @@ FROM root]]> - + @@ -211,7 +211,7 @@ FROM root]]> - + @@ -221,7 +221,7 @@ FROM root]]> - + diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringCompareTo.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringCompareTo.xml index 979d6f6191..71478f4b01 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringCompareTo.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringCompareTo.xml @@ -171,7 +171,7 @@ FROM root]]> - + @@ -181,7 +181,7 @@ FROM root]]> - + @@ -191,7 +191,7 @@ FROM root]]> - + diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Microsoft.Azure.Cosmos.EmulatorTests.csproj b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Microsoft.Azure.Cosmos.EmulatorTests.csproj index 3d1a5e15a8..8011b07351 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Microsoft.Azure.Cosmos.EmulatorTests.csproj +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Microsoft.Azure.Cosmos.EmulatorTests.csproj @@ -1,4 +1,4 @@ - + true true @@ -214,6 +214,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest From b3e36207067338815f197f4a000b938dee3deb58 Mon Sep 17 00:00:00 2001 From: Ernesto Cortes Groman Date: Mon, 10 Jul 2023 16:12:40 -0700 Subject: [PATCH 9/9] Update base line --- .../LinqTranslationBaselineTests.TestStringCompare.xml | 6 +++--- .../LinqTranslationBaselineTests.TestStringCompareTo.xml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringCompare.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringCompare.xml index 9e0b1b6b01..17538ff1d8 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringCompare.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringCompare.xml @@ -201,7 +201,7 @@ FROM root]]> - + @@ -211,7 +211,7 @@ FROM root]]> - + @@ -221,7 +221,7 @@ FROM root]]> - + diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringCompareTo.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringCompareTo.xml index 71478f4b01..c730415fb6 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringCompareTo.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringCompareTo.xml @@ -171,7 +171,7 @@ FROM root]]> - + @@ -181,7 +181,7 @@ FROM root]]> - + @@ -191,7 +191,7 @@ FROM root]]> - +