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

Support for merging spark application config with dataframe config. #18040

Merged

Conversation

moderakh
Copy link
Contributor

@moderakh moderakh commented Dec 9, 2020

This PR adds support for merging spark application config with dataframe options.
Cosmos Spark3 DataSourceV2.

example:

val sparkConfig = new SparkConf()
sparkConfig.set("spark.cosmos.accountEndpoint", cosmosEndpoint)
sparkConfig.set("spark.cosmos.accountKey", cosmosMasterKey)

val spark = SparkSession.builder()
  .appName("spark connector sample")
  .master("local")
  .config(sparkConfig)
  .getOrCreate()

val options = Map(
  "spark.cosmos.database" -> cosmosDatabase,
  "spark.cosmos.container" -> cosmosContainer
)
val df = spark.read.format("cosmos.items").options(options).load()

see SparkE2EConfigResolutionSpec e2e test for more examples.

TODO:

  • we should investigate how to merge spark sql config.
  • we should investigate how to integrate this with catalog api (if possible)

@kirankumarkolli
Copy link
Member

What are the OLAP configs?

One more alternative is spark.azure.cosmos.accountEndpoint

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.

Nice one!

@moderakh
Copy link
Contributor Author

moderakh commented Dec 9, 2020

What are the OLAP configs?

One more alternative is spark.azure.cosmos.accountEndpoint

@kirankumarkolli we are using the same config name prefixes in OLAP and synapse unified spark connector.

Before we GA the spark3 oltp connector, similar to sdk we should go over all the configs and review together.

@moderakh moderakh merged commit 430efac into Azure:feature/cosmos/spark30 Dec 10, 2020
@moderakh moderakh deleted the users/moderakh/spark-app-config branch December 10, 2020 22:39
@moderakh moderakh linked an issue Dec 18, 2020 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cosmos:spark3 Cosmos DB Spark3 OLTP Connector Cosmos
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support merging spark application config with dataframe config
3 participants