Skip to content

Commit

Permalink
Subpartitioning: Fixes handling of split physical partitions (#3879)
Browse files Browse the repository at this point in the history
* Initial Commit DO NOT REVIEW

* bug fix, needs Direct Package Changes

* fix for change feed and query plus tests

* clean up

* query + clean up

---------

Co-authored-by: Kiran Kumar Kolli <[email protected]>
  • Loading branch information
NaluTripician and kirankumarkolli authored Jun 12, 2023
1 parent b924209 commit ea10439
Show file tree
Hide file tree
Showing 3 changed files with 527 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@

namespace Microsoft.Azure.Cosmos
{
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Azure.Cosmos.Routing;
using Microsoft.Azure.Cosmos.Tracing;
using Microsoft.Azure.Documents;

/// <summary>
/// FeedRange that represents an exact Partition Key value.
Expand All @@ -31,8 +33,13 @@ public FeedRangePartitionKey(PartitionKey partitionKey)
return Task.FromResult(
new List<Documents.Routing.Range<string>>
{
Documents.Routing.Range<string>.GetPointRange(
this.PartitionKey.InternalKey.GetEffectivePartitionKeyString(partitionKeyDefinition))
Documents.Routing.PartitionKeyInternal.GetEffectivePartitionKeyRange(
partitionKeyDefinition,
new Documents.Routing.Range<Documents.Routing.PartitionKeyInternal>(
min: this.PartitionKey.InternalKey,
max: this.PartitionKey.InternalKey,
isMinInclusive: true,
isMaxInclusive: true))
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,7 @@ internal PartitionedQueryExecutionInfo ConvertPartitionedQueryExecutionInfo(
List<Documents.Routing.Range<string>> effectiveRanges = new List<Documents.Routing.Range<string>>(queryInfoInternal.QueryRanges.Count);
foreach (Documents.Routing.Range<PartitionKeyInternal> internalRange in queryInfoInternal.QueryRanges)
{
effectiveRanges.Add(new Documents.Routing.Range<string>(
internalRange.Min.GetEffectivePartitionKeyString(partitionKeyDefinition, false),
internalRange.Max.GetEffectivePartitionKeyString(partitionKeyDefinition, false),
internalRange.IsMinInclusive,
internalRange.IsMaxInclusive));
effectiveRanges.Add(PartitionKeyInternal.GetEffectivePartitionKeyRange(partitionKeyDefinition, internalRange));
}

effectiveRanges.Sort(Documents.Routing.Range<string>.MinComparer.Instance);
Expand Down
Loading

0 comments on commit ea10439

Please sign in to comment.