Skip to content

Conversation

@SrinikhilReddy
Copy link
Contributor

@SrinikhilReddy SrinikhilReddy commented Jan 7, 2021

SDK Changes to support Subpartitioning.

  1. Adds the new PartitionKind 'MultiHash' which accepts multiple Partition keys.
  2. Operations currently supported
    1. Document/Container CRUD operations with MultiHash Partition Kind.

@ghost ghost added the Cosmos label Jan 7, 2021
@kushagraThapar kushagraThapar changed the title [Internal] Subpartitioning: Adds SDK changes to support subpartitioning. [DO NOT MERGE] Subpartitioning: Adds SDK changes to support subpartitioning. Jan 7, 2021
@SrinikhilReddy SrinikhilReddy marked this pull request as ready for review January 12, 2021 17:41
@kushagraThapar kushagraThapar changed the title [DO NOT MERGE] Subpartitioning: Adds SDK changes to support subpartitioning. Subpartitioning: Adds SDK changes to support subpartitioning. Jan 12, 2021
Copy link
Contributor

@moderakh moderakh left a 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:

  1. Single Partition Query when you specify the partition-key value in the query text
  2. Single Partition Query when you specify the partition-key value in the query option.
  3. cross partition query when you specify the partial partition-key value prefix in the query text
  4. cross partition query when you specify the partial partition-key value prefix in the query option
  5. Batch
  6. 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

* @param keys the value of partition keys.
*/
@SuppressWarnings("serial")
public PartitionKey(final Object[] keys) {
Copy link
Contributor

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?

Copy link
Contributor Author

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.*;
Copy link
Contributor

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

*
*/

package com.azure.cosmos;
Copy link
Contributor

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.

@moderakh
Copy link
Contributor

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

SrinikhilReddy and others added 2 commits January 15, 2021 14:10
Co-authored-by: Mohammad Derakhshani <moderakh@users.noreply.github.com>
this.partitionKeyValues = new ArrayList<Object>();
}

public PartitionKeyBuilder Add(String value)
Copy link
Contributor

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()
{
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

break;
case MULTI_HASH:
Object[] partitionKeyValues = new Object[partitionKeyDefinition.getPaths().size()];
for(int path_iter = 0 ; path_iter < partitionKeyDefinition.getPaths().size(); path_iter++)
Copy link
Member

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.

Copy link
Contributor

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.

return this;
}

public PartitionKeyBuilder AddNoneValue()
Copy link
Member

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.

Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added code comments..

@SrinikhilReddy
Copy link
Contributor Author

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Commenter does not have sufficient privileges for PR 18503 in repo Azure/azure-sdk-for-java

@kushagraThapar
Copy link
Member

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@kushagraThapar kushagraThapar left a 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.

Copy link
Contributor

@moderakh moderakh left a 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

@SrinikhilReddy
Copy link
Contributor Author

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

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!

Copy link
Member

@simplynaveen20 simplynaveen20 left a 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

@kushagraThapar
Copy link
Member

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kushagraThapar
Copy link
Member

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kushagraThapar kushagraThapar merged commit 5499f82 into Azure:master Jun 11, 2021
azure-sdk pushed a commit to azure-sdk/azure-sdk-for-java that referenced this pull request Apr 8, 2022
Add dapr AppInsights connection string (Azure#18503)

* Add dapr AppInsights connection string

* Remove the deprecation note for now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants