Skip to content

Commit

Permalink
Address NullPointerException in CosmosDataItemSource ctor (Azure#35201)
Browse files Browse the repository at this point in the history
* Address NullPointerException in CosmosDataItemSource ctor

Address NullPointerException when Spark runtime hasn't been initialized when CosmosDataItemSource ctor is called

* Update changelog

* Update CosmosItemsDataSource.scala
  • Loading branch information
FabianMeiswinkel authored May 31, 2023
1 parent 645bca4 commit f941be2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion sdk/cosmos/azure-cosmos-spark_3-1_2-12/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

#### Bugs Fixed
* Fixed `IllegalArgumentException` when different throughput control group is defined on the same container - See [PR 34702](https://github.com/Azure/azure-sdk-for-java/pull/34702)

* Addressed `NullPointerException` in `CosmosDataItemSource` constructor when Spark runtime initialization hasn't completed yet. - See [PR 35201](https://github.com/Azure/azure-sdk-for-java/pull/35201)

### 4.18.1 (2023-04-10)

#### Bugs Fixed
Expand Down
1 change: 1 addition & 0 deletions sdk/cosmos/azure-cosmos-spark_3-2_2-12/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#### Bugs Fixed
* Fixed `IllegalArgumentException` when different throughput control group is defined on the same container - See [PR 34702](https://github.com/Azure/azure-sdk-for-java/pull/34702)
* Addressed `NullPointerException` in `CosmosDataItemSource` constructor when Spark runtime initialization hasn't completed yet. - See [PR 35201](https://github.com/Azure/azure-sdk-for-java/pull/35201)

### 4.18.1 (2023-04-10)

Expand Down
1 change: 1 addition & 0 deletions sdk/cosmos/azure-cosmos-spark_3-3_2-12/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#### Bugs Fixed
* Fixed `IllegalArgumentException` when different throughput control group is defined on the same container - See [PR 34702](https://github.com/Azure/azure-sdk-for-java/pull/34702)
* Addressed `NullPointerException` in `CosmosDataItemSource` constructor when Spark runtime initialization hasn't completed yet. - See [PR 35201](https://github.com/Azure/azure-sdk-for-java/pull/35201)

### 4.18.1 (2023-04-10)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ import scala.collection.JavaConverters._
class CosmosItemsDataSource extends DataSourceRegister with TableProvider with BasicLoggingTrait {
logInfo(s"Instantiated ${this.getClass.getSimpleName}")

assertOnSparkDriver()
private lazy val sparkSession = SparkSession.active
private lazy val sparkSession = {
assertOnSparkDriver()
SparkSession.active
}

/**
* Infer the schema of the table identified by the given options.
Expand Down

0 comments on commit f941be2

Please sign in to comment.