Skip to content

Commit 76a9a7c

Browse files
authored
Cosmos Spark added missing dependency (Azure#20304)
- cosmos spark added missing dependency `scala-java8-compat_2.12` - improved error for case when id is missing.
1 parent c48532a commit 76a9a7c

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

sdk/cosmos/azure-cosmos-spark_3-1_2-12/pom.xml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@
6666
<groupId>org.scala-lang.modules</groupId>
6767
<artifactId>scala-java8-compat_2.12</artifactId>
6868
<version>0.8.0</version> <!-- {x-version-update;cosmos_org.scala-lang.modules:scala-java8-compat_2.12;external_dependency} -->
69-
<scope>provided</scope> <!-- Databricks Runtime8 has 0.8.0 jar https://docs.databricks.com/release-notes/runtime/8.0ml.html -->
7069
</dependency>
7170
<dependency>
7271
<groupId>io.projectreactor</groupId>
@@ -347,6 +346,14 @@
347346
<exclude>com.azure.cosmos.models.CosmosParameterizedQuery</exclude>
348347
</excludes>
349348
</relocation>
349+
<relocation>
350+
<pattern>scala.compat.java8</pattern>
351+
<shadedPattern>${shadingPrefix}.scala.compat.java8</shadedPattern>
352+
</relocation>
353+
<relocation>
354+
<pattern>scala.concurrent.java8</pattern>
355+
<shadedPattern>${shadingPrefix}.scala.concurrent.java8</shadedPattern>
356+
</relocation>
350357
<relocation>
351358
<pattern>io.netty</pattern>
352359
<shadedPattern>${shadingPrefix}.io.netty</shadedPattern>

sdk/cosmos/azure-cosmos-spark_3-1_2-12/src/main/scala/com/azure/cosmos/spark/ItemsDataWriteFactory.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ private class ItemsDataWriteFactory(userConfig: Map[String, String],
8686
// TODO moderakh support patch?
8787
// TODO moderakh bulkWrite in another PR
8888

89-
if (!objectNode.has(CosmosConstants.Properties.Id) ||
90-
!objectNode.get(CosmosConstants.Properties.Id).isTextual) {
91-
logError(s"${CosmosConstants.Properties.Id} is a mandatory field. " +
89+
require(objectNode.has(CosmosConstants.Properties.Id) &&
90+
objectNode.get(CosmosConstants.Properties.Id).isTextual,
91+
s"${CosmosConstants.Properties.Id} is a mandatory field. " +
9292
s"But it is missing or it is not a string")
93-
}
93+
9494
val partitionKeyValue = PartitionKeyHelper.getPartitionKeyPath(objectNode, partitionKeyDefinition)
9595
writer.scheduleWrite(partitionKeyValue, objectNode)
9696
}

0 commit comments

Comments
 (0)