Add throughput bucket samples for Cosmos Spark connector#48734
Open
xinlian12 wants to merge 1 commit intoAzure:mainfrom
Open
Add throughput bucket samples for Cosmos Spark connector#48734xinlian12 wants to merge 1 commit intoAzure:mainfrom
xinlian12 wants to merge 1 commit intoAzure:mainfrom
Conversation
Add Python (.ipynb) and Scala sample notebooks demonstrating server-side throughput bucket configuration as an alternative to SDK-based global throughput control. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds new Scala and Python Databricks sample notebooks under azure-cosmos-spark_3 demonstrating server-side throughput buckets (spark.cosmos.throughputControl.throughputBucket) for the NYC Taxi ingestion workflow, modeled after the existing 01_Batch samples but without SDK/global throughput-control metadata container setup.
Changes:
- Add Scala Databricks notebook sample showing ingest/query/CF validation and deletes using throughput buckets.
- Add PySpark Databricks notebook sample showing the same flow using throughput buckets.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| sdk/cosmos/azure-cosmos-spark_3/Samples/Scala/NYC-Taxi-Data/04_ThroughputBucket.scala | New Scala Databricks sample demonstrating throughput bucket configuration for ingest and delete workloads. |
| sdk/cosmos/azure-cosmos-spark_3/Samples/Python/NYC-Taxi-Data/04_ThroughputBucket.ipynb | New PySpark Databricks sample notebook demonstrating throughput bucket configuration for ingest and delete workloads. |
sdk/cosmos/azure-cosmos-spark_3/Samples/Python/NYC-Taxi-Data/04_ThroughputBucket.ipynb
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos-spark_3/Samples/Python/NYC-Taxi-Data/04_ThroughputBucket.ipynb
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos-spark_3/Samples/Scala/NYC-Taxi-Data/04_ThroughputBucket.scala
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos-spark_3/Samples/Scala/NYC-Taxi-Data/04_ThroughputBucket.scala
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos-spark_3/Samples/Scala/NYC-Taxi-Data/04_ThroughputBucket.scala
Show resolved
Hide resolved
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.
Summary
Add Python and Scala sample notebooks demonstrating server-side throughput bucket configuration for the Cosmos Spark connector (
azure-cosmos-spark_3).Changes
Samples/Python/NYC-Taxi-Data/04_ThroughputBucket.ipynb— PySpark notebookSamples/Scala/NYC-Taxi-Data/04_ThroughputBucket.scala— Scala Databricks notebookBoth samples are modeled after the existing
01_Batchsamples but replace the SDK-side global throughput control with the simpler server-sidethroughputBucketconfiguration:spark.cosmos.throughputControl.enabled"true"spark.cosmos.throughputControl.namespark.cosmos.throughputControl.throughputBucket1and5Key differences from
01_BatchThroughputControlmetadata container creation (not needed for server-side buckets)targetThroughputThreshold,globalControl.database,globalControl.containerwiththroughputBucketVerification
These are Databricks notebook samples and do not have associated unit tests. The structure and configuration keys were verified against the Spark connector source code (
CosmosConfig.scala,ThroughputControlHelper.scala).