Skip to content

Commit

Permalink
GTC-2824 Deal with case of Invalid rows in raster gadm optimization.
Browse files Browse the repository at this point in the history
In the case of Invalid rows, we don't move the gadm out of the feature
id, so we need to deal with FeatureId that still has gadm.
  • Loading branch information
danscales committed Sep 14, 2024
1 parent 9a9a39c commit 7800580
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package org.globalforestwatch.summarystats.gfwpro_dashboard

import org.apache.spark.rdd.RDD
import org.apache.spark.sql.{DataFrame, SparkSession}
import org.globalforestwatch.features.{FeatureId, GfwProFeatureId}
import org.globalforestwatch.features.{FeatureId, GfwProFeatureId, CombinedFeatureId, GadmFeatureId}
import org.globalforestwatch.summarystats._
import cats.data.Validated.{Valid, Invalid}
import org.apache.spark.sql.functions.expr
Expand All @@ -19,6 +19,10 @@ object GfwProDashboardDF extends SummaryDF {
val rowId: FeatureId => RowId = {
case proId: GfwProFeatureId =>
RowId(proId.listId, proId.locationId.toString)
// The following case is to deal with Invalid rows, which have not had the gadm
// information moved out of the feature id.
case CombinedFeatureId(proId: GfwProFeatureId, _) =>
RowId(proId.listId, proId.locationId.toString)
case _ =>
throw new IllegalArgumentException("Not a CombinedFeatureId[GfwProFeatureId, GadmFeatureId]")
}
Expand Down

0 comments on commit 7800580

Please sign in to comment.