From 60a58d5cce1e7fd910f946b46a621f9a6ed811b0 Mon Sep 17 00:00:00 2001 From: tvaron3 Date: Sun, 31 Aug 2025 21:48:39 -0700 Subject: [PATCH 1/4] Add audience as valid config --- sdk/cosmos/azure-cosmos-spark_3-5_2-12/CHANGELOG.md | 2 ++ .../scala/com/azure/cosmos/spark/CosmosConfig.scala | 2 ++ .../test/java/com/azure/cosmos/CosmosItemTest.java | 13 ++++++------- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/sdk/cosmos/azure-cosmos-spark_3-5_2-12/CHANGELOG.md b/sdk/cosmos/azure-cosmos-spark_3-5_2-12/CHANGELOG.md index 50f5c804e184..14b59d0ea736 100644 --- a/sdk/cosmos/azure-cosmos-spark_3-5_2-12/CHANGELOG.md +++ b/sdk/cosmos/azure-cosmos-spark_3-5_2-12/CHANGELOG.md @@ -10,6 +10,8 @@ * Added log4j-core to the list of shaded packages to avoid conflicts when customers use log4j in a different version. - See [PR 45924](https://github.com/Azure/azure-sdk-for-java/pull/46451) #### Other Changes +* Added change feed performance monitoring which is used to improve end lsn calculation in `CosmosPartitionPlanner`. - See [PR 46320](https://github.com/Azure/azure-sdk-for-java/pull/46320) +* Added `spark.cosmos.auth.aad.audience` as a valid configuration option to allow using AAD tokens with custom audiences. - See []() ### 4.38.0 (2025-07-31) diff --git a/sdk/cosmos/azure-cosmos-spark_3_2-12/src/main/scala/com/azure/cosmos/spark/CosmosConfig.scala b/sdk/cosmos/azure-cosmos-spark_3_2-12/src/main/scala/com/azure/cosmos/spark/CosmosConfig.scala index 2d699d23aba3..29a93965f7a1 100644 --- a/sdk/cosmos/azure-cosmos-spark_3_2-12/src/main/scala/com/azure/cosmos/spark/CosmosConfig.scala +++ b/sdk/cosmos/azure-cosmos-spark_3_2-12/src/main/scala/com/azure/cosmos/spark/CosmosConfig.scala @@ -58,6 +58,7 @@ private[spark] object CosmosConfigNames { val ClientSecret = "spark.cosmos.auth.aad.clientSecret" val ClientCertPemBase64 = "spark.cosmos.auth.aad.clientCertPemBase64" val ClientCertSendChain = "spark.cosmos.auth.aad.clientCertSendChain" + val Audience = "spark.cosmos.auth.aad.audience" val Database = "spark.cosmos.database" val Container = "spark.cosmos.container" val PreferredRegionsList = "spark.cosmos.preferredRegionsList" @@ -180,6 +181,7 @@ private[spark] object CosmosConfigNames { ClientSecret, ClientCertPemBase64, ClientCertSendChain, + Audience, AzureEnvironment, AzureEnvironmentAAD, AzureEnvironmentManagement, diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/CosmosItemTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/CosmosItemTest.java index 3f3396cf1adc..3b7e8873eaec 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/CosmosItemTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/CosmosItemTest.java @@ -105,14 +105,14 @@ public void afterClass() { @Test(groups = { "fast" }, timeOut = TIMEOUT) public void createItem() throws Exception { InternalObjectNode properties = getDocumentDefinition(UUID.randomUUID().toString()); + properties.set("mypk", null); CosmosItemResponse itemResponse = container.createItem(properties); assertThat(itemResponse.getRequestCharge()).isGreaterThan(0); validateItemResponse(properties, itemResponse); properties = getDocumentDefinition(UUID.randomUUID().toString()); logger.info("Testing log"); - CosmosItemResponse itemResponse1 = container.createItem(properties, new CosmosItemRequestOptions()); - validateItemResponse(properties, itemResponse1); + CosmosItemResponse itemResponse1 = container.deleteItem(properties.getId(),new PartitionKey(null), new CosmosItemRequestOptions()); } @Test(groups = {"fast"}, timeOut = TIMEOUT) @@ -1228,10 +1228,13 @@ public void readAllItems() throws Exception { @Test(groups = { "fast" }, timeOut = TIMEOUT) public void queryItems() throws Exception{ InternalObjectNode properties = getDocumentDefinition(UUID.randomUUID().toString()); + properties.set("mypk", null); CosmosItemResponse itemResponse = container.createItem(properties); - String query = String.format("SELECT * from c where c.id = '%s'", properties.getId()); + String query = String.format("SELECT * from c"); CosmosQueryRequestOptions cosmosQueryRequestOptions = new CosmosQueryRequestOptions(); + cosmosQueryRequestOptions.setPartitionKey(new PartitionKey(null)); + CosmosPagedIterable feedResponseIterator1 = container.queryItems(query, cosmosQueryRequestOptions, InternalObjectNode.class); @@ -1239,10 +1242,6 @@ public void queryItems() throws Exception{ // Very basic validation assertThat(feedResponseIterator1.iterator().hasNext()).isTrue(); - SqlQuerySpec querySpec = new SqlQuerySpec(query); - CosmosPagedIterable feedResponseIterator3 = - container.queryItems(querySpec, cosmosQueryRequestOptions, InternalObjectNode.class); - assertThat(feedResponseIterator3.iterator().hasNext()).isTrue(); } @Test(groups = { "fast" }, timeOut = TIMEOUT) From 0d8def7d91f9c4256fdc78c2b41e7b582d86182f Mon Sep 17 00:00:00 2001 From: tvaron3 Date: Sun, 31 Aug 2025 21:53:33 -0700 Subject: [PATCH 2/4] update changelog --- sdk/cosmos/azure-cosmos-spark_3-5_2-12/CHANGELOG.md | 3 +-- .../test/java/com/azure/cosmos/CosmosItemTest.java | 13 +++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sdk/cosmos/azure-cosmos-spark_3-5_2-12/CHANGELOG.md b/sdk/cosmos/azure-cosmos-spark_3-5_2-12/CHANGELOG.md index 14b59d0ea736..c65dabacaad0 100644 --- a/sdk/cosmos/azure-cosmos-spark_3-5_2-12/CHANGELOG.md +++ b/sdk/cosmos/azure-cosmos-spark_3-5_2-12/CHANGELOG.md @@ -10,8 +10,7 @@ * Added log4j-core to the list of shaded packages to avoid conflicts when customers use log4j in a different version. - See [PR 45924](https://github.com/Azure/azure-sdk-for-java/pull/46451) #### Other Changes -* Added change feed performance monitoring which is used to improve end lsn calculation in `CosmosPartitionPlanner`. - See [PR 46320](https://github.com/Azure/azure-sdk-for-java/pull/46320) -* Added `spark.cosmos.auth.aad.audience` as a valid configuration option to allow using AAD tokens with custom audiences. - See []() +* Added `spark.cosmos.auth.aad.audience` as a valid configuration option to allow using AAD tokens with custom audiences. - See [PR 46554](https://github.com/Azure/azure-sdk-for-java/pull/46554) ### 4.38.0 (2025-07-31) diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/CosmosItemTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/CosmosItemTest.java index 3b7e8873eaec..3f3396cf1adc 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/CosmosItemTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/CosmosItemTest.java @@ -105,14 +105,14 @@ public void afterClass() { @Test(groups = { "fast" }, timeOut = TIMEOUT) public void createItem() throws Exception { InternalObjectNode properties = getDocumentDefinition(UUID.randomUUID().toString()); - properties.set("mypk", null); CosmosItemResponse itemResponse = container.createItem(properties); assertThat(itemResponse.getRequestCharge()).isGreaterThan(0); validateItemResponse(properties, itemResponse); properties = getDocumentDefinition(UUID.randomUUID().toString()); logger.info("Testing log"); - CosmosItemResponse itemResponse1 = container.deleteItem(properties.getId(),new PartitionKey(null), new CosmosItemRequestOptions()); + CosmosItemResponse itemResponse1 = container.createItem(properties, new CosmosItemRequestOptions()); + validateItemResponse(properties, itemResponse1); } @Test(groups = {"fast"}, timeOut = TIMEOUT) @@ -1228,13 +1228,10 @@ public void readAllItems() throws Exception { @Test(groups = { "fast" }, timeOut = TIMEOUT) public void queryItems() throws Exception{ InternalObjectNode properties = getDocumentDefinition(UUID.randomUUID().toString()); - properties.set("mypk", null); CosmosItemResponse itemResponse = container.createItem(properties); - String query = String.format("SELECT * from c"); + String query = String.format("SELECT * from c where c.id = '%s'", properties.getId()); CosmosQueryRequestOptions cosmosQueryRequestOptions = new CosmosQueryRequestOptions(); - cosmosQueryRequestOptions.setPartitionKey(new PartitionKey(null)); - CosmosPagedIterable feedResponseIterator1 = container.queryItems(query, cosmosQueryRequestOptions, InternalObjectNode.class); @@ -1242,6 +1239,10 @@ public void queryItems() throws Exception{ // Very basic validation assertThat(feedResponseIterator1.iterator().hasNext()).isTrue(); + SqlQuerySpec querySpec = new SqlQuerySpec(query); + CosmosPagedIterable feedResponseIterator3 = + container.queryItems(querySpec, cosmosQueryRequestOptions, InternalObjectNode.class); + assertThat(feedResponseIterator3.iterator().hasNext()).isTrue(); } @Test(groups = { "fast" }, timeOut = TIMEOUT) From f39f7aa300ade42edc937d978871aefb3fb5a9e2 Mon Sep 17 00:00:00 2001 From: tvaron3 Date: Sun, 31 Aug 2025 21:54:05 -0700 Subject: [PATCH 3/4] update changelog --- sdk/cosmos/azure-cosmos-spark_3-5_2-12/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sdk/cosmos/azure-cosmos-spark_3-5_2-12/CHANGELOG.md b/sdk/cosmos/azure-cosmos-spark_3-5_2-12/CHANGELOG.md index c65dabacaad0..16af86a9910c 100644 --- a/sdk/cosmos/azure-cosmos-spark_3-5_2-12/CHANGELOG.md +++ b/sdk/cosmos/azure-cosmos-spark_3-5_2-12/CHANGELOG.md @@ -10,6 +10,7 @@ * Added log4j-core to the list of shaded packages to avoid conflicts when customers use log4j in a different version. - See [PR 45924](https://github.com/Azure/azure-sdk-for-java/pull/46451) #### Other Changes +* Added change feed performance monitoring which is used to improve end lsn calculation in `CosmosPartitionPlanner`. - See [PR 46320](https://github.com/Azure/azure-sdk-for-java/pull/46320) * Added `spark.cosmos.auth.aad.audience` as a valid configuration option to allow using AAD tokens with custom audiences. - See [PR 46554](https://github.com/Azure/azure-sdk-for-java/pull/46554) ### 4.38.0 (2025-07-31) From 89a7fc2e6db2ec6019c3329484b9d023ff0cc376 Mon Sep 17 00:00:00 2001 From: tvaron3 Date: Mon, 1 Sep 2025 19:08:27 -0700 Subject: [PATCH 4/4] update changelog --- sdk/cosmos/azure-cosmos-spark_3-3_2-12/CHANGELOG.md | 1 + sdk/cosmos/azure-cosmos-spark_3-4_2-12/CHANGELOG.md | 1 + 2 files changed, 2 insertions(+) diff --git a/sdk/cosmos/azure-cosmos-spark_3-3_2-12/CHANGELOG.md b/sdk/cosmos/azure-cosmos-spark_3-3_2-12/CHANGELOG.md index dbd5ddc24cf3..9742a702ad43 100644 --- a/sdk/cosmos/azure-cosmos-spark_3-3_2-12/CHANGELOG.md +++ b/sdk/cosmos/azure-cosmos-spark_3-3_2-12/CHANGELOG.md @@ -11,6 +11,7 @@ #### Other Changes * Added change feed performance monitoring which is used to improve end lsn calculation in `CosmosPartitionPlanner`. - See [PR 46320](https://github.com/Azure/azure-sdk-for-java/pull/46320) +* Added `spark.cosmos.auth.aad.audience` as a valid configuration option to allow using AAD tokens with custom audiences. - See [PR 46554](https://github.com/Azure/azure-sdk-for-java/pull/46554) ### 4.38.0 (2025-07-31) diff --git a/sdk/cosmos/azure-cosmos-spark_3-4_2-12/CHANGELOG.md b/sdk/cosmos/azure-cosmos-spark_3-4_2-12/CHANGELOG.md index 4920a3e39739..e107292a9b6f 100644 --- a/sdk/cosmos/azure-cosmos-spark_3-4_2-12/CHANGELOG.md +++ b/sdk/cosmos/azure-cosmos-spark_3-4_2-12/CHANGELOG.md @@ -11,6 +11,7 @@ #### Other Changes * Added change feed performance monitoring which is used to improve end lsn calculation in `CosmosPartitionPlanner`. - See [PR 46320](https://github.com/Azure/azure-sdk-for-java/pull/46320) +* Added `spark.cosmos.auth.aad.audience` as a valid configuration option to allow using AAD tokens with custom audiences. - See [PR 46554](https://github.com/Azure/azure-sdk-for-java/pull/46554) ### 4.38.0 (2025-07-31)