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

Support sub-partitioning in Node SDK #23416

Closed
sajeetharan opened this issue Oct 6, 2022 · 0 comments
Closed

Support sub-partitioning in Node SDK #23416

sajeetharan opened this issue Oct 6, 2022 · 0 comments
Assignees
Labels
Cosmos feature-request This issue requires a new behavior in the product in order be resolved.

Comments

@sajeetharan
Copy link
Member

sajeetharan commented Oct 6, 2022

Is your feature request related to a problem? Please describe.
https://learn.microsoft.com/en-us/azure/cosmos-db/hierarchical-partition-keys?tabs=net-v3%2Cbicep
With sub-partitioning customers can natively partition their container with up to three levels of partition keys

DOTNET SDK PR
Azure/azure-cosmos-dotnet-v3#1658

@sajeetharan sajeetharan added Cosmos feature-request This issue requires a new behavior in the product in order be resolved. labels Oct 6, 2022
@sajeetharan sajeetharan self-assigned this Oct 6, 2022
@sajeetharan sajeetharan moved this to Ready to start in @azure/cosmos Project Oct 6, 2022
@v1k1 v1k1 moved this from Ready to start to In Progress in @azure/cosmos Project Oct 20, 2022
@v1k1 v1k1 moved this from In Progress to In Review in @azure/cosmos Project Nov 23, 2022
v1k1 added a commit that referenced this issue Mar 6, 2023
Packages impacted by this PR
@azure/cosmos

Issues associated with this PR
#23416

Describe the problem that is addressed by this PR
Added Hierarchical Partition Key Support

Refactored Definition of PartitionKey.
Old definition - type PartitionKey = PartitionKeyDefinition | string | number | unknown;
New definition - type PartitionKey = PrimitivePartitionKeyValue | PrimitivePartitionKeyValue[];
The main change here is
a) Separating out PartitionKeyDefinition [May seem like a breaking change. But the actual functions which need PartitionKeyDefinition were always taking PartitionKeyDefinition as an input i.e. ContainerDefinition, the existing definition seems confusing.]
b) Removal of unknown from definition (along with adding boolean). Defining it as PartitionKeyDefinition | string | number | unknown was effectively equivalent to unknown, since or of anything with unknown is unknown. Which essentially means we had no structure upon PartitionKey. This seems like a huge bug.
Introduced PartitionKeyInternal to create a boundary beyond with PartitionKey would be sanitized. The idea is to use ClientContext as that boundary.
Changed bulk/batch api Operation/OperationInput DTOs partitionKey field to PartitionKey type.
Clearly defined order for choosing partitionKey for an operation during bulk api. Now if the user has provided partitionKey in OperationInput it will be used, if not it will be derived from resource body (for create and upsert).
Added logic for MultiHash calculation.
Changed FeedOption.partitionKey filed to PartitionKey type.
[[Bugs fixes]]

In bulk api, The case when partition key path has escaped characters was not handled. In batch.ts -> deepFind() method.
In bulk/batch api Operation/OperationInput DTOs were inconsistent in supporting type of partition key values.
What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen?
Are there test cases added in this PR? (If not, why?)
Yes

Provide a list of related PRs (if any)
Command used to generate this PR:**(Applicable only to SDK release request PRs)
Checklists
 Added impacted package name to the issue description
 Does this PR needs any fixes in the SDK Generator?** (If so, create an Issue in the Autorest/typescript repository and link it here)
 Added a changelog (if necessary)
@v1k1 v1k1 moved this from In Review to Done in @azure/cosmos Project Jul 25, 2023
@v1k1 v1k1 closed this as completed Jul 25, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Oct 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Cosmos feature-request This issue requires a new behavior in the product in order be resolved.
Projects
None yet
Development

No branches or pull requests

2 participants