-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Subpartitioning: Adds SDK changes to support subpartitioning. #18503
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @SrinikhilReddy
a few comments:
we should consider using a builder pattern for validating that all the partition key components are primitive. Could you check what DotNet v3 SDK is doing?
We should add tests for the following scenarios:
Query:
- Single Partition Query when you specify the partition-key value in the query text
- Single Partition Query when you specify the partition-key value in the query option.
- cross partition query when you specify the partial partition-key value prefix in the query text
- cross partition query when you specify the partial partition-key value prefix in the query option
- Batch
- Bulk
You should run the full CIs against live endpoint.
For testing as we are bumping the API version we should run the full CTL run.
Could you sync with Naveen on running the CTL
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxDocumentClientImpl.java
Outdated
Show resolved
Hide resolved
| * @param keys the value of partition keys. | ||
| */ | ||
| @SuppressWarnings("serial") | ||
| public PartitionKey(final Object[] keys) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Object can be any non primitive type, however for subpartitioning we only support primitive types,
we should consider using a builder pattern to construct and validate the content instead of passing raw object array.
Could you check what DotNet v3 is doing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the pattern as suggested.
| import com.azure.cosmos.models.IndexingPolicy; | ||
| import com.azure.cosmos.models.SqlQuerySpec; | ||
| import com.azure.cosmos.models.ThroughputProperties; | ||
| import com.azure.cosmos.models.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code style: we don't do wildcard import.
You can change your intellj/eclipse default behaviour not not use wildcard import.
see this: https://stackoverflow.com/questions/3348816/intellij-never-use-wildcard-imports
sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosMultiHashTest.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosMultiHashTest.java
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosMultiHashTest.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosContainerTest.java
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosMultiHashTest.java
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/PartitionKind.java
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosMultiHashTest.java
Show resolved
Hide resolved
| * | ||
| */ | ||
|
|
||
| package com.azure.cosmos; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please run the full CI run against the live endpoints.
sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosMultiHashTest.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxDocumentClientImpl.java
Show resolved
Hide resolved
|
/azp run java - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Co-authored-by: Mohammad Derakhshani <moderakh@users.noreply.github.com>
| this.partitionKeyValues = new ArrayList<Object>(); | ||
| } | ||
|
|
||
| public PartitionKeyBuilder Add(String value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
java style lower camel case, same for the other methods here.
| * Constructor. CREATE a new instance of the PartitionKeyBuilder object. | ||
| */ | ||
| public PartitionKeyBuilder() | ||
| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: java code style '{' on the same line as method, for other new methods too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/HttpConstants.java
Show resolved
Hide resolved
| break; | ||
| case MULTI_HASH: | ||
| Object[] partitionKeyValues = new Object[partitionKeyDefinition.getPaths().size()]; | ||
| for(int path_iter = 0 ; path_iter < partitionKeyDefinition.getPaths().size(); path_iter++) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@moderakh any suggestions on elegant way of iteration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is possible to use java stream.
partitionKeyDefinition.getPaths().stream().map ....
but not much difference functional wise.
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/PartitionKind.java
Show resolved
Hide resolved
| return this; | ||
| } | ||
|
|
||
| public PartitionKeyBuilder AddNoneValue() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code doc please.
For None please cover it explicitly on targeted scenarios.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Null and None dis-ambiguration is very important in docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added code comments..
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/PartitionKeyBuilder.java
Outdated
Show resolved
Hide resolved
|
/azp run java - cosmos - tests |
|
Commenter does not have sufficient privileges for PR 18503 in repo Azure/azure-sdk-for-java |
|
/azp run java - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
kushagraThapar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good to me, please get it reviewed by @moderakh before merging it in. Thanks @SrinikhilReddy for your contribution, appreciate it.
...cosmos/src/main/java/com/azure/cosmos/implementation/routing/PartitionKeyInternalHelper.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/PartitionKeyBuilder.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/PartitionKeyBuilder.java
Show resolved
Hide resolved
moderakh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please replace Document and InternalObjectNode with ObjectNode in the new test class.
Document and InternalObjectNode are internal types and as tests may be used later as sample by some customers this will be confusing to the customers.
please make sure full CI and CTL pass. after next version of SDK is released, please merge
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxDocumentClientImpl.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxDocumentClientImpl.java
Outdated
Show resolved
Hide resolved
...cosmos/src/main/java/com/azure/cosmos/implementation/routing/PartitionKeyInternalHelper.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/util/Beta.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosMultiHashTest.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosMultiHashTest.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosMultiHashTest.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosMultiHashTest.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosMultiHashTest.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosMultiHashTest.java
Outdated
Show resolved
Hide resolved
Fixed as you suggested Mo, synced with naveen for CTL runs. Will ping the folks on this thread once i get a successful CTL run. Thank you! |
simplynaveen20
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CTL results look good
|
/azp run java - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/PartitionKeyBuilder.java
Outdated
Show resolved
Hide resolved
|
/azp run java - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Add dapr AppInsights connection string (Azure#18503) * Add dapr AppInsights connection string * Remove the deprecation note for now
SDK Changes to support Subpartitioning.