Skip to content

Commit db9b88f

Browse files
committed
Resolve merge conflicts with master.
2 parents 08f87b2 + 0d22105 commit db9b88f

11 files changed

Lines changed: 78 additions & 33 deletions

File tree

Microsoft.Azure.Cosmos/src/Fluent/Settings/VectorIndexDefinition.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,12 @@ VectorIndexDefinition<T> WithIndexingSearchListSize(
9898
/// applies to index types DiskANN and quantizedFlat.
9999
/// </param>
100100
/// <returns>An instance of the current <see cref="VectorIndexDefinition{T}"/>.</returns>
101-
internal VectorIndexDefinition<T> WithVectorIndexShardKey(
101+
#if PREVIEW
102+
public
103+
#else
104+
internal
105+
#endif
106+
VectorIndexDefinition<T> WithVectorIndexShardKey(
102107
string[] vectorIndexShardKey)
103108
{
104109
this.vectorIndexPath.VectorIndexShardKey = vectorIndexShardKey ?? throw new ArgumentNullException(nameof(vectorIndexShardKey));

Microsoft.Azure.Cosmos/src/Json/Interop/CosmosDBToNewtonsoftWriter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ public override void WriteValue(decimal value)
322322
/// <param name="value">The <see cref="DateTime"/> value to write.</param>
323323
public override void WriteValue(DateTime value)
324324
{
325-
this.WriteValue(value.ToString());
325+
this.WriteValue(value.ToString("O"));
326326
}
327327

328328
/// <summary>

Microsoft.Azure.Cosmos/src/Resource/Settings/VectorIndexPath.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ public sealed class VectorIndexPath
7070

7171
/// <summary>
7272
/// Gets or sets the quantization byte size for the vector index path. This is only applicable for the quantizedFlat and diskann vector index types.
73-
/// The allowed range for this parameter is between 1 and the minimum of vector dimensions and 512.
73+
/// The allowed range for this parameter is between 1 and min(dimensions, 512).
74+
/// e.g. if dimensions is 256, then allowed range for QuantizationByteSize is between 1 and 256 if dimensions is 1024,
75+
/// then allowed range for QuantizationByteSize is between 1 and 512
7476
/// </summary>
7577
[JsonIgnore]
7678
#if PREVIEW
@@ -102,10 +104,14 @@ int IndexingSearchListSize
102104

103105
/// <summary>
104106
/// Gets or sets the vector index shard key for the vector index path. This is only applicable for the quantizedFlat and diskann vector index types.
105-
/// The maximum length of the vector index shard key is 1.
106107
/// </summary>
107108
[JsonProperty(PropertyName = "vectorIndexShardKey", NullValueHandling = NullValueHandling.Ignore)]
108-
internal string[] VectorIndexShardKey { get; set; }
109+
#if PREVIEW
110+
public
111+
#else
112+
internal
113+
#endif
114+
string[] VectorIndexShardKey { get; set; }
109115

110116
/// <summary>
111117
/// This contains additional values for scenarios where the SDK is not aware of new fields.

Microsoft.Azure.Cosmos/src/Routing/GlobalEndpointManager.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -771,11 +771,7 @@ public IList<string> GetEffectivePreferredLocations()
771771

772772
public Uri ResolveThinClientEndpoint(DocumentServiceRequest request)
773773
{
774-
bool isReadRequest = request.IsReadOnlyRequest
775-
|| request.OperationType == OperationType.Query
776-
|| request.OperationType == OperationType.ReadFeed;
777-
778-
return this.locationCache.ResolveThinClientEndpoint(request, isReadRequest);
774+
return this.locationCache.ResolveThinClientEndpoint(request, request.IsReadOnlyRequest);
779775
}
780776
}
781777
}

Microsoft.Azure.Cosmos/src/ThinClientStoreClient.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,6 @@ private async ValueTask<HttpRequestMessage> PrepareRequestForProxyAsync(
9191
BufferProviderWrapper bufferProviderWrapper = this.bufferProviderWrapperPool.Get();
9292
try
9393
{
94-
ContainerProperties collection = await clientCollectionCache.ResolveCollectionAsync(
95-
request,
96-
CancellationToken.None,
97-
NoOpTrace.Singleton);
98-
request.ResourceId = collection.ResourceId;
9994
requestMessage.Headers.TryAddWithoutValidation(
10095
ThinClientConstants.ProxyOperationType,
10196
request.OperationType.ToOperationTypeString());

Microsoft.Azure.Cosmos/src/ThinClientTransportSerializer.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ public static async Task<Stream> SerializeProxyRequestAsync(
6767
AuthorizationTokenType.PrimaryMasterKey,
6868
dictionaryCollection);
6969

70+
ContainerProperties collection = await clientCollectionCache.ResolveCollectionAsync(
71+
request,
72+
CancellationToken.None,
73+
NoOpTrace.Singleton);
74+
7075
if (operationType.IsPointOperation())
7176
{
7277
string partitionKey = request.Headers.Get(HttpConstants.HttpHeaders.PartitionKey);
@@ -76,10 +81,6 @@ public static async Task<Stream> SerializeProxyRequestAsync(
7681
throw new InternalServerErrorException();
7782
}
7883

79-
ContainerProperties collection = await clientCollectionCache.ResolveCollectionAsync(
80-
request,
81-
CancellationToken.None,
82-
NoOpTrace.Singleton);
8384
string epk = GetEffectivePartitionKeyHash(partitionKey, collection.PartitionKey);
8485

8586
request.Properties = new Dictionary<string, object>
@@ -100,6 +101,8 @@ public static async Task<Stream> SerializeProxyRequestAsync(
100101
request.Headers.Add(HttpConstants.HttpHeaders.StartEpk, request.Headers[ThinClientConstants.ProxyStartEpk]);
101102
request.Headers.Add(HttpConstants.HttpHeaders.EndEpk, request.Headers[ThinClientConstants.ProxyEndEpk]);
102103
}
104+
request.ResourceId = collection.ResourceId;
105+
request.Headers.Add(WFConstants.BackendHeaders.CollectionRid, collection.ResourceId);
103106

104107
await request.EnsureBufferedBodyAsync();
105108

Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Fluent/ContainerSettingsTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ await databaseForVectorEmbedding.DefineContainer(containerName, partitionKeyPath
591591
.WithVectorIndex()
592592
.Path(vector3Path, VectorIndexType.DiskANN)
593593
.WithQuantizationByteSize(2)
594-
.WithIndexingSearchListSize(5)
594+
.WithIndexingSearchListSize(35)
595595
.WithVectorIndexShardKey(new string[] { "/ZipCode" })
596596
.Attach()
597597
.Attach()
@@ -620,7 +620,7 @@ await databaseForVectorEmbedding.DefineContainer(containerName, partitionKeyPath
620620
Assert.AreEqual(vector3Path, containerSettings.IndexingPolicy.VectorIndexes[2].Path);
621621
Assert.AreEqual(VectorIndexType.DiskANN, containerSettings.IndexingPolicy.VectorIndexes[2].Type);
622622
Assert.AreEqual(2, containerSettings.IndexingPolicy.VectorIndexes[2].QuantizationByteSize);
623-
Assert.AreEqual(5, containerSettings.IndexingPolicy.VectorIndexes[2].IndexingSearchListSize);
623+
Assert.AreEqual(35, containerSettings.IndexingPolicy.VectorIndexes[2].IndexingSearchListSize);
624624
CollectionAssert.AreEqual(new string[] { "/ZipCode" }, containerSettings.IndexingPolicy.VectorIndexes[2].VectorIndexShardKey);
625625
}
626626
finally

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,6 +1249,11 @@
12491249
"Type": "Method",
12501250
"Attributes": [],
12511251
"MethodInfo": "Microsoft.Azure.Cosmos.Fluent.VectorIndexDefinition`1[T] WithQuantizationByteSize(Int32);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
1252+
},
1253+
"Microsoft.Azure.Cosmos.Fluent.VectorIndexDefinition`1[T] WithVectorIndexShardKey(System.String[])": {
1254+
"Type": "Method",
1255+
"Attributes": [],
1256+
"MethodInfo": "Microsoft.Azure.Cosmos.Fluent.VectorIndexDefinition`1[T] WithVectorIndexShardKey(System.String[]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
12521257
}
12531258
},
12541259
"NestedTypes": {}
@@ -1644,6 +1649,20 @@
16441649
],
16451650
"MethodInfo": "Int32 QuantizationByteSize;CanRead:True;CanWrite:True;Int32 get_QuantizationByteSize();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_QuantizationByteSize(Int32);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
16461651
},
1652+
"System.String[] get_VectorIndexShardKey()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
1653+
"Type": "Method",
1654+
"Attributes": [
1655+
"CompilerGeneratedAttribute"
1656+
],
1657+
"MethodInfo": "System.String[] get_VectorIndexShardKey();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
1658+
},
1659+
"System.String[] VectorIndexShardKey[Newtonsoft.Json.JsonPropertyAttribute(NullValueHandling = 1, PropertyName = \"vectorIndexShardKey\")]": {
1660+
"Type": "Property",
1661+
"Attributes": [
1662+
"JsonPropertyAttribute"
1663+
],
1664+
"MethodInfo": "System.String[] VectorIndexShardKey;CanRead:True;CanWrite:True;System.String[] get_VectorIndexShardKey();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_VectorIndexShardKey(System.String[]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
1665+
},
16471666
"Void set_IndexingSearchListSize(Int32)": {
16481667
"Type": "Method",
16491668
"Attributes": [],
@@ -1653,6 +1672,13 @@
16531672
"Type": "Method",
16541673
"Attributes": [],
16551674
"MethodInfo": "Void set_QuantizationByteSize(Int32);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
1675+
},
1676+
"Void set_VectorIndexShardKey(System.String[])[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
1677+
"Type": "Method",
1678+
"Attributes": [
1679+
"CompilerGeneratedAttribute"
1680+
],
1681+
"MethodInfo": "Void set_VectorIndexShardKey(System.String[]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
16561682
}
16571683
},
16581684
"NestedTypes": {}

Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Fluent/ContainerDefinitionForCreateTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ public async Task ValidateVectorEmbeddingsAndIndexingPolicyUsingContainerBuilder
490490
.WithVectorIndex()
491491
.Path(vector3Path, VectorIndexType.DiskANN)
492492
.WithQuantizationByteSize(2)
493-
.WithIndexingSearchListSize(5)
493+
.WithIndexingSearchListSize(35)
494494
.WithVectorIndexShardKey(new string[] { "/ZipCode" })
495495
.Attach()
496496
.Attach()

Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/NewtonsoftInteropTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public void AllPrimitivesObjectTest()
202202
new JProperty("string", "XCPCFXPHHF"),
203203
new JProperty("boolean", true),
204204
new JProperty("null", null),
205-
new JProperty("datetime", "2526-07-11T18:18:16.4520716"),
205+
new JProperty("datetime", DateTime.Parse("2526-07-11T18:18:16.4520716")),
206206
new JProperty("spatialPoint", new JObject(
207207
new JProperty("type", "Point"),
208208
new JProperty("coordinate", new double[] { 118.9897, -46.6781 }))),

0 commit comments

Comments
 (0)