Skip to content

Commit 47ac92e

Browse files
committed
-fix: handle change to collectDoubles in convertTileDriftSeriesInfoToTimeSeries
1 parent 38ea292 commit 47ac92e

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

hub/src/main/scala/ai/chronon/hub/handlers/TimeSeriesHandler.scala

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,18 @@ class TimeSeriesHandler(driftStore: DriftStore) {
119119
// check if we have a numeric / categorical feature. If the percentile drift series has non-null doubles
120120
// then we have a numeric feature at hand
121121
val isNumeric =
122-
tileDriftSeries.percentileDriftSeries.asScala != null && tileDriftSeries.percentileDriftSeries.asScala
123-
.exists(_ != null)
122+
Option(tileDriftSeries.percentileDriftSeries).exists(series =>
123+
series.asScala.exists(_ != null))
124+
124125
val lhsList = if (metric == NullMetric) {
125-
tileDriftSeries.nullRatioChangePercentSeries.asScala
126+
Option(tileDriftSeries.nullRatioChangePercentSeries).map(_.asScala).getOrElse(Seq.empty)
126127
} else {
127-
if (isNumeric) tileDriftSeries.percentileDriftSeries.asScala
128-
else tileDriftSeries.histogramDriftSeries.asScala
128+
if (isNumeric)
129+
Option(tileDriftSeries.percentileDriftSeries).map(_.asScala).getOrElse(Seq.empty)
130+
else
131+
Option(tileDriftSeries.histogramDriftSeries).map(_.asScala).getOrElse(Seq.empty)
129132
}
133+
130134
val points = lhsList.zip(tileDriftSeries.timestamps.asScala).map {
131135
case (v, ts) => TimeSeriesPoint(v, ts)
132136
}

0 commit comments

Comments
 (0)