Skip to content

Commit 1623250

Browse files
author
annie-mac
committed
fix
1 parent d7331f9 commit 1623250

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

sdk/cosmos/azure-cosmos-spark_3-4_2-12/src/main/scala/com/azure/cosmos/spark/SparkInternalsBridge.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ object SparkInternalsBridge extends BasicLoggingTrait {
8080
}
8181
}
8282

83-
private def getInternalCustomTaskMetricsAsSQLMetricInternal(
83+
private def ConsistencygetInternalCustomTaskMetricsAsSQLMetricInternal(
8484
knownCosmosMetricNames: Set[String],
8585
taskMetrics: TaskMetrics): Map[String, SQLMetric] = {
8686
getAccumulators(taskMetrics) match {

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,9 @@ private[cosmos] case class PartitionMetadata
132132
}
133133

134134
def getAvgChangesPerLsn: Double = {
135-
val effectiveFirstLsn = if (this.firstLsn.isEmpty) 0 else this.firstLsn.get
136-
if (this.documentCount == 0 || (this.getAndValidateLatestLsn - effectiveFirstLsn) <= 0) {
135+
if (this.firstLsn.isEmpty) {
136+
math.max(1d, this.documentCount.toDouble / this.getAndValidateLatestLsn)
137+
} else if (this.documentCount == 0 || (this.getAndValidateLatestLsn - this.firstLsn.get) <= 0) {
137138
1d
138139
} else {
139140
this.documentCount.toDouble / (this.getAndValidateLatestLsn- this.firstLsn.get)

0 commit comments

Comments
 (0)