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

[Cosmos] Computed properties support #35046

Merged
merged 13 commits into from
Jun 9, 2023

Conversation

balalakshmin
Copy link
Member

@balalakshmin balalakshmin commented May 19, 2023

Description

Adding computed properties support in CosmosContainerProperties.
Corresponding .Net PR

Usage

        List<ComputedProperty> computedProperties = new ArrayList<>(
            Arrays.asList(
                new ComputedProperty("lowerName", "SELECT VALUE LOWER(IS_DEFINED(c.lastName) ? c.lastName : c.parents[0].familyName) FROM c"),
                new ComputedProperty("upperName", "SELECT VALUE UPPER(IS_DEFINED(c.lastName) ? c.lastName : c.parents[0].familyName) FROM c")
            )
        );

        containerProperties.setComputedProperties(computedProperties);
        CosmosContainerResponse containerResponse = createdDatabase.createContainer(containerProperties);

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

@azure-sdk
Copy link
Collaborator

API change check

APIView has identified API level changes in this PR and created following API reviews.

azure-cosmos

Copy link
Member

@FabianMeiswinkel FabianMeiswinkel left a comment

Choose a reason for hiding this comment

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

Mostly blocking in the probably incomplete JsonSerializable implementation.

Copy link
Member

@FabianMeiswinkel FabianMeiswinkel left a comment

Choose a reason for hiding this comment

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

LGTM now...

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.

Thanks for the changes @balalakshmin, they look great.

One new process that we are starting now is to make sure that every feature PR also adds samples / documentation about the feature.

For this one, I think we should add the code snippet about this feature, in the samples folder, and then reference those code snippets in the java docs on these APIs.

You can see the example of throughput control / change feed processor, also this sample PR will show you how / where to add the code snippets - #35300

Copy link
Member

@xinlian12 xinlian12 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

@balalakshmin
Copy link
Member Author

/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.

LGTM, thanks @balalakshmin !

@@ -0,0 +1,79 @@
package com.azure.cosmos;
Copy link
Member

Choose a reason for hiding this comment

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

missing new file license header. Can be added later on after CI finishes.

@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 299d2e5 into main Jun 9, 2023
@kushagraThapar kushagraThapar deleted the users/balalakshmin/computedprops branch June 9, 2023 14:38
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.

5 participants