Adding support to create GSI containers#48480
Draft
mbhaskar wants to merge 1 commit intoAzure:mainfrom
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Materialized View Support — Change Summary
Overview
This branch adds client-side support for Materialized Views/Global Secondary Index in the Azure Cosmos DB Java SDK.
Materialized views are derived containers built from a source container using a SQL-like projection
query. The changes expose two properties that the service already supports:
materializedViewDefinitionmaterializedViewscontainer.read()responsesImportant Changes
CosmosMaterializedViewDefinition.javaPackage:
com.azure.cosmos.modelsRepresents the write-side definition of a materialized view container. The source
container Rid should be set when creating a materialized view container.
Example usage:
getSourceCollectionRid()_ridof the source containersetSourceCollectionRid(String)_ridof the source container. Fluent.getDefinition()setDefinition(String)Wire format:
CosmosMaterializedView.javaPackage:
com.azure.cosmos.modelsA read-only model representing a single entry in the
materializedViewsarray returned by theservice when reading a source container. Each entry identifies one derived materialized view
container.
getId()getResourceId()_ridExample Usage:
CosmosContainerProperties.javaTwo new public methods:
setMaterializedViewDefinition(CosmosMaterializedViewDefinition)this. ThrowsNullPointerExceptionifnullis passed.getMaterializedViewDefinition()nullif not set.getMaterializedViews()CosmosMaterializedViewentries populated by the service when reading a source container. Returns an empty list if not present.DocumentCollection.javaInternal backing implementation for
CosmosContainerProperties:cosmosMaterializedViewDefinitionfield with lazy-load cachinggetMaterializedViewDefinition()— lazy-loads from the property bag usinggetObject()setMaterializedViewDefinition()— null-checks, caches the value, and persists to the property bag viaset()getMaterializedViews()— reads the server-populated list directly from the property bag viagetList(), returns an unmodifiable listConstants.javaFour new string constants added under a
// Materialized View Definitionsection:MATERIALIZED_VIEW_DEFINITION"materializedViewDefinition"MATERIALIZED_VIEW_SOURCE_COLLECTION_RID"sourceCollectionRid"MATERIALIZED_VIEW_QUERY_DEFINITION"definition"MATERIALIZED_VIEWS"materializedViews"Test Coverage (
MaterializedViewTest.java)Unit tests added for the new materialized view properties on
CosmosContainerProperties:All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines