Skip to content

Commit f941be2

Browse files
Address NullPointerException in CosmosDataItemSource ctor (Azure#35201)
* Address NullPointerException in CosmosDataItemSource ctor Address NullPointerException when Spark runtime hasn't been initialized when CosmosDataItemSource ctor is called * Update changelog * Update CosmosItemsDataSource.scala
1 parent 645bca4 commit f941be2

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

sdk/cosmos/azure-cosmos-spark_3-1_2-12/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414

1515
#### Bugs Fixed
1616
* 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)
17-
17+
* 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)
18+
1819
### 4.18.1 (2023-04-10)
1920

2021
#### Bugs Fixed

sdk/cosmos/azure-cosmos-spark_3-2_2-12/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#### Bugs Fixed
1616
* 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)
17+
* 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)
1718

1819
### 4.18.1 (2023-04-10)
1920

sdk/cosmos/azure-cosmos-spark_3-3_2-12/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#### Bugs Fixed
1616
* 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)
17+
* 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)
1718

1819
### 4.18.1 (2023-04-10)
1920

sdk/cosmos/azure-cosmos-spark_3_2-12/src/main/scala/com/azure/cosmos/spark/CosmosItemsDataSource.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ import scala.collection.JavaConverters._
2323
class CosmosItemsDataSource extends DataSourceRegister with TableProvider with BasicLoggingTrait {
2424
logInfo(s"Instantiated ${this.getClass.getSimpleName}")
2525

26-
assertOnSparkDriver()
27-
private lazy val sparkSession = SparkSession.active
26+
private lazy val sparkSession = {
27+
assertOnSparkDriver()
28+
SparkSession.active
29+
}
2830

2931
/**
3032
* Infer the schema of the table identified by the given options.

0 commit comments

Comments
 (0)