Skip to content

Commit 80647ba

Browse files
[Internal] Direct Package: Adds Support for Direct package version 3.33.0 (#4353)
* upgraded direct package version * added Taiwan regions * update contracts * fix contracts * fixed more contracts * contracts change * contract change remove * changed baseline files * added space * added region name check test for future verification * nits --------- Co-authored-by: Sourabh Jain <[email protected]>
1 parent 1106cd7 commit 80647ba

File tree

6 files changed

+75
-42
lines changed

6 files changed

+75
-42
lines changed

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<ClientOfficialVersion>3.38.1</ClientOfficialVersion>
44
<ClientPreviewVersion>3.39.0</ClientPreviewVersion>
55
<ClientPreviewSuffixVersion>preview.1</ClientPreviewSuffixVersion>
6-
<DirectVersion>3.32.1</DirectVersion>
6+
<DirectVersion>3.33.0</DirectVersion>
77
<EncryptionOfficialVersion>2.0.4</EncryptionOfficialVersion>
88
<EncryptionPreviewVersion>2.1.0</EncryptionPreviewVersion>
99
<EncryptionPreviewSuffixVersion>preview4</EncryptionPreviewSuffixVersion>

Microsoft.Azure.Cosmos/src/Regions.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,5 +374,15 @@ public static class Regions
374374
/// Name of the Azure Spain Central region in the Azure Cosmos DB service.
375375
/// </summary>
376376
public const string SpainCentral = "Spain Central";
377+
378+
/// <summary>
379+
/// Name of the Azure Taiwan North region in the Azure Cosmos DB service.
380+
/// </summary>
381+
public const string TaiwanNorth = "Taiwan North";
382+
383+
/// <summary>
384+
/// Name of the Azure Taiwan Northwest region in the Azure Cosmos DB service.
385+
/// </summary>
386+
public const string TaiwanNorthwest = "Taiwan Northwest";
377387
}
378388
}

Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.GroupBy.xml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -311,14 +311,6 @@ GROUP BY c.age, c.name]]></RewrittenQuery>
311311
<OrderByExpressions />
312312
<Aggregates />
313313
<GroupByAliasToAggregateType>
314-
<AliasToAggregateType>
315-
<Alias>min_age</Alias>
316-
<AggregateOperator>Min</AggregateOperator>
317-
</AliasToAggregateType>
318-
<AliasToAggregateType>
319-
<Alias>max_age</Alias>
320-
<AggregateOperator>Max</AggregateOperator>
321-
</AliasToAggregateType>
322314
<AliasToAggregateType>
323315
<Alias>count</Alias>
324316
<AggregateOperator>Count</AggregateOperator>
@@ -331,6 +323,14 @@ GROUP BY c.age, c.name]]></RewrittenQuery>
331323
<Alias>team</Alias>
332324
<AggregateOperator>null</AggregateOperator>
333325
</AliasToAggregateType>
326+
<AliasToAggregateType>
327+
<Alias>min_age</Alias>
328+
<AggregateOperator>Min</AggregateOperator>
329+
</AliasToAggregateType>
330+
<AliasToAggregateType>
331+
<Alias>max_age</Alias>
332+
<AggregateOperator>Max</AggregateOperator>
333+
</AliasToAggregateType>
334334
<AliasToAggregateType>
335335
<Alias>avg_age</Alias>
336336
<AggregateOperator>Average</AggregateOperator>
@@ -504,10 +504,6 @@ GROUP BY UPPER(c.name), SUBSTRING(c.address.city, 0, 3)]]></RewrittenQuery>
504504
<OrderByExpressions />
505505
<Aggregates />
506506
<GroupByAliasToAggregateType>
507-
<AliasToAggregateType>
508-
<Alias>group_name</Alias>
509-
<AggregateOperator>null</AggregateOperator>
510-
</AliasToAggregateType>
511507
<AliasToAggregateType>
512508
<Alias>count</Alias>
513509
<AggregateOperator>Count</AggregateOperator>
@@ -516,6 +512,10 @@ GROUP BY UPPER(c.name), SUBSTRING(c.address.city, 0, 3)]]></RewrittenQuery>
516512
<Alias>info</Alias>
517513
<AggregateOperator>null</AggregateOperator>
518514
</AliasToAggregateType>
515+
<AliasToAggregateType>
516+
<Alias>group_name</Alias>
517+
<AggregateOperator>null</AggregateOperator>
518+
</AliasToAggregateType>
519519
</GroupByAliasToAggregateType>
520520
<GroupByAliases>
521521
<Alias>info</Alias>
@@ -718,17 +718,13 @@ GROUP BY c.name]]></RewrittenQuery>
718718
<Aggregates />
719719
<GroupByAliasToAggregateType>
720720
<AliasToAggregateType>
721-
<Alias>max_age</Alias>
722-
<AggregateOperator>Max</AggregateOperator>
721+
<Alias>count</Alias>
722+
<AggregateOperator>Count</AggregateOperator>
723723
</AliasToAggregateType>
724724
<AliasToAggregateType>
725725
<Alias>name</Alias>
726726
<AggregateOperator>null</AggregateOperator>
727727
</AliasToAggregateType>
728-
<AliasToAggregateType>
729-
<Alias>count</Alias>
730-
<AggregateOperator>Count</AggregateOperator>
731-
</AliasToAggregateType>
732728
<AliasToAggregateType>
733729
<Alias>$1</Alias>
734730
<AggregateOperator>Min</AggregateOperator>
@@ -741,6 +737,10 @@ GROUP BY c.name]]></RewrittenQuery>
741737
<Alias>$2</Alias>
742738
<AggregateOperator>Max</AggregateOperator>
743739
</AliasToAggregateType>
740+
<AliasToAggregateType>
741+
<Alias>max_age</Alias>
742+
<AggregateOperator>Max</AggregateOperator>
743+
</AliasToAggregateType>
744744
<AliasToAggregateType>
745745
<Alias>avg_age</Alias>
746746
<AggregateOperator>Average</AggregateOperator>

Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.NonValueAggregates.xml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -509,11 +509,11 @@ FROM c]]></RewrittenQuery>
509509
<Aggregates />
510510
<GroupByAliasToAggregateType>
511511
<AliasToAggregateType>
512-
<Alias>min_blah2</Alias>
512+
<Alias>min_blah</Alias>
513513
<AggregateOperator>Min</AggregateOperator>
514514
</AliasToAggregateType>
515515
<AliasToAggregateType>
516-
<Alias>min_blah</Alias>
516+
<Alias>min_blah2</Alias>
517517
<AggregateOperator>Min</AggregateOperator>
518518
</AliasToAggregateType>
519519
</GroupByAliasToAggregateType>
@@ -557,11 +557,11 @@ FROM c]]></RewrittenQuery>
557557
<Aggregates />
558558
<GroupByAliasToAggregateType>
559559
<AliasToAggregateType>
560-
<Alias>max_blah</Alias>
560+
<Alias>max_blah2</Alias>
561561
<AggregateOperator>Max</AggregateOperator>
562562
</AliasToAggregateType>
563563
<AliasToAggregateType>
564-
<Alias>max_blah2</Alias>
564+
<Alias>max_blah</Alias>
565565
<AggregateOperator>Max</AggregateOperator>
566566
</AliasToAggregateType>
567567
</GroupByAliasToAggregateType>
@@ -605,11 +605,11 @@ FROM c]]></RewrittenQuery>
605605
<Aggregates />
606606
<GroupByAliasToAggregateType>
607607
<AliasToAggregateType>
608-
<Alias>avg_blah2</Alias>
608+
<Alias>avg_blah</Alias>
609609
<AggregateOperator>Average</AggregateOperator>
610610
</AliasToAggregateType>
611611
<AliasToAggregateType>
612-
<Alias>avg_blah</Alias>
612+
<Alias>avg_blah2</Alias>
613613
<AggregateOperator>Average</AggregateOperator>
614614
</AliasToAggregateType>
615615
</GroupByAliasToAggregateType>
@@ -989,11 +989,11 @@ FROM c]]></RewrittenQuery>
989989
<Aggregates />
990990
<GroupByAliasToAggregateType>
991991
<AliasToAggregateType>
992-
<Alias>$1</Alias>
992+
<Alias>count_blah</Alias>
993993
<AggregateOperator>Count</AggregateOperator>
994994
</AliasToAggregateType>
995995
<AliasToAggregateType>
996-
<Alias>count_blah</Alias>
996+
<Alias>$1</Alias>
997997
<AggregateOperator>Count</AggregateOperator>
998998
</AliasToAggregateType>
999999
</GroupByAliasToAggregateType>
@@ -1181,11 +1181,11 @@ FROM c]]></RewrittenQuery>
11811181
<Aggregates />
11821182
<GroupByAliasToAggregateType>
11831183
<AliasToAggregateType>
1184-
<Alias>max_blah</Alias>
1184+
<Alias>$1</Alias>
11851185
<AggregateOperator>Max</AggregateOperator>
11861186
</AliasToAggregateType>
11871187
<AliasToAggregateType>
1188-
<Alias>$1</Alias>
1188+
<Alias>max_blah</Alias>
11891189
<AggregateOperator>Max</AggregateOperator>
11901190
</AliasToAggregateType>
11911191
</GroupByAliasToAggregateType>
@@ -1229,11 +1229,11 @@ FROM c]]></RewrittenQuery>
12291229
<Aggregates />
12301230
<GroupByAliasToAggregateType>
12311231
<AliasToAggregateType>
1232-
<Alias>max_blah</Alias>
1232+
<Alias>$1</Alias>
12331233
<AggregateOperator>Max</AggregateOperator>
12341234
</AliasToAggregateType>
12351235
<AliasToAggregateType>
1236-
<Alias>$1</Alias>
1236+
<Alias>max_blah</Alias>
12371237
<AggregateOperator>Max</AggregateOperator>
12381238
</AliasToAggregateType>
12391239
</GroupByAliasToAggregateType>
@@ -1428,15 +1428,15 @@ FROM c]]></RewrittenQuery>
14281428
<Aggregates />
14291429
<GroupByAliasToAggregateType>
14301430
<AliasToAggregateType>
1431-
<Alias>$1</Alias>
1431+
<Alias>count_blah</Alias>
14321432
<AggregateOperator>Count</AggregateOperator>
14331433
</AliasToAggregateType>
14341434
<AliasToAggregateType>
1435-
<Alias>count_blah</Alias>
1435+
<Alias>count_blah2</Alias>
14361436
<AggregateOperator>Count</AggregateOperator>
14371437
</AliasToAggregateType>
14381438
<AliasToAggregateType>
1439-
<Alias>count_blah2</Alias>
1439+
<Alias>$1</Alias>
14401440
<AggregateOperator>Count</AggregateOperator>
14411441
</AliasToAggregateType>
14421442
</GroupByAliasToAggregateType>
@@ -1486,11 +1486,11 @@ FROM c]]></RewrittenQuery>
14861486
<AggregateOperator>Min</AggregateOperator>
14871487
</AliasToAggregateType>
14881488
<AliasToAggregateType>
1489-
<Alias>min_blah2</Alias>
1489+
<Alias>min_blah</Alias>
14901490
<AggregateOperator>Min</AggregateOperator>
14911491
</AliasToAggregateType>
14921492
<AliasToAggregateType>
1493-
<Alias>min_blah</Alias>
1493+
<Alias>min_blah2</Alias>
14941494
<AggregateOperator>Min</AggregateOperator>
14951495
</AliasToAggregateType>
14961496
</GroupByAliasToAggregateType>
@@ -1536,15 +1536,15 @@ FROM c]]></RewrittenQuery>
15361536
<Aggregates />
15371537
<GroupByAliasToAggregateType>
15381538
<AliasToAggregateType>
1539-
<Alias>max_blah</Alias>
1539+
<Alias>$1</Alias>
15401540
<AggregateOperator>Max</AggregateOperator>
15411541
</AliasToAggregateType>
15421542
<AliasToAggregateType>
15431543
<Alias>max_blah2</Alias>
15441544
<AggregateOperator>Max</AggregateOperator>
15451545
</AliasToAggregateType>
15461546
<AliasToAggregateType>
1547-
<Alias>$1</Alias>
1547+
<Alias>max_blah</Alias>
15481548
<AggregateOperator>Max</AggregateOperator>
15491549
</AliasToAggregateType>
15501550
</GroupByAliasToAggregateType>
@@ -1594,11 +1594,11 @@ FROM c]]></RewrittenQuery>
15941594
<AggregateOperator>Average</AggregateOperator>
15951595
</AliasToAggregateType>
15961596
<AliasToAggregateType>
1597-
<Alias>avg_blah2</Alias>
1597+
<Alias>avg_blah</Alias>
15981598
<AggregateOperator>Average</AggregateOperator>
15991599
</AliasToAggregateType>
16001600
<AliasToAggregateType>
1601-
<Alias>avg_blah</Alias>
1601+
<Alias>avg_blah2</Alias>
16021602
<AggregateOperator>Average</AggregateOperator>
16031603
</AliasToAggregateType>
16041604
</GroupByAliasToAggregateType>

Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DirectContractTests.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@ namespace Microsoft.Azure.Cosmos.Contracts
1010
using System.Linq;
1111
using System.Reflection;
1212
using System.Runtime.InteropServices;
13-
using System.Text;
1413
using System.Text.RegularExpressions;
1514
using Microsoft.Azure.Cosmos.Query.Core.Monads;
1615
using Microsoft.Azure.Cosmos.Query.Core.QueryPlan;
1716
using Microsoft.Azure.Documents;
1817
using Microsoft.VisualStudio.TestTools.UnitTesting;
19-
using Newtonsoft.Json;
2018

2119
[TestCategory("Windows")]
2220
[TestClass]
@@ -81,6 +79,21 @@ public void MappedRegionsTest()
8179
CollectionAssert.AreEquivalent(locationNames, cosmosRegions);
8280
}
8381

82+
[TestMethod]
83+
public void RegionValueCheck()
84+
{
85+
string[] cosmosRegions = typeof(Regions)
86+
.GetMembers(BindingFlags.Static | BindingFlags.Public)
87+
.Select(e => e.Name)
88+
.ToArray();
89+
foreach (string region in cosmosRegions)
90+
{
91+
string locationNameValue = typeof(LocationNames).GetField(region).GetValue(null).ToString();
92+
string regionNameValue = typeof(Regions).GetField(region).GetValue(null).ToString();
93+
Assert.AreEqual(locationNameValue, regionNameValue);
94+
}
95+
}
96+
8497
[TestMethod]
8598
public void RMContractTest()
8699
{

Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetSDKAPI.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7100,6 +7100,16 @@
71007100
"Attributes": [],
71017101
"MethodInfo": "System.String SwitzerlandWest;IsInitOnly:False;IsStatic:True;"
71027102
},
7103+
"System.String TaiwanNorth": {
7104+
"Type": "Field",
7105+
"Attributes": [],
7106+
"MethodInfo": "System.String TaiwanNorth;IsInitOnly:False;IsStatic:True;"
7107+
},
7108+
"System.String TaiwanNorthwest": {
7109+
"Type": "Field",
7110+
"Attributes": [],
7111+
"MethodInfo": "System.String TaiwanNorthwest;IsInitOnly:False;IsStatic:True;"
7112+
},
71037113
"System.String UAECentral": {
71047114
"Type": "Field",
71057115
"Attributes": [],

0 commit comments

Comments
 (0)