Skip to content

Commit f6e5370

Browse files
committed
Merge branch 'develop' into feature/agg-overview
* develop: PR feedback on NoData check for masking remove comments and cruft from unit test Fix for 409: assert on mask target must have NoData defined # Conflicts: # core/src/test/scala/org/locationtech/rasterframes/RasterFunctionsSpec.scala # docs/src/main/paradox/release-notes.md
2 parents d699a76 + 1425d37 commit f6e5370

File tree

6 files changed

+487
-403
lines changed

6 files changed

+487
-403
lines changed

core/src/main/scala/org/locationtech/rasterframes/expressions/transformers/Mask.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ package org.locationtech.rasterframes.expressions.transformers
2323

2424
import com.typesafe.scalalogging.Logger
2525
import geotrellis.raster
26-
import geotrellis.raster.Tile
26+
import geotrellis.raster.{NoNoData, Tile}
2727
import geotrellis.raster.mapalgebra.local.{Undefined, InverseMask gtInverseMask, Mask gtMask}
2828
import org.apache.spark.sql.catalyst.analysis.TypeCheckResult
2929
import org.apache.spark.sql.catalyst.analysis.TypeCheckResult.{TypeCheckFailure, TypeCheckSuccess}
@@ -73,6 +73,10 @@ abstract class Mask(val left: Expression, val middle: Expression, val right: Exp
7373
override protected def nullSafeEval(targetInput: Any, maskInput: Any, maskValueInput: Any): Any = {
7474
implicit val tileSer = TileUDT.tileSerializer
7575
val (targetTile, targetCtx) = tileExtractor(targetExp.dataType)(row(targetInput))
76+
77+
require(! targetTile.cellType.isInstanceOf[NoNoData],
78+
s"Input data expression ${left.prettyName} must have a CellType with NoData defined in order to perform a masking operation. Found CellType ${targetTile.cellType.toString()}.")
79+
7680
val (maskTile, maskCtx) = tileExtractor(maskExp.dataType)(row(maskInput))
7781

7882
if (targetCtx.isEmpty && maskCtx.isDefined)

0 commit comments

Comments
 (0)