File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
main/scala/org/locationtech/rasterframes/extensions
test/scala/org/locationtech/rasterframes/functions Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ object RasterJoin {
104104 // Assumes all LHS tiles in a row are of the same size.
105105 val destDims =
106106 if (left.tileColumns.nonEmpty)
107- rf_dimensions( coalesce(left.tileColumns.map(unresolved): _* ) )
107+ coalesce(left.tileColumns.map(unresolved).map(rf_dimensions) : _* )
108108 else
109109 serialized_literal(fallbackDimensions.getOrElse(NOMINAL_TILE_DIMS ))
110110
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ import geotrellis.raster._
2727import geotrellis .raster .testkit .RasterMatchers
2828import javax .imageio .ImageIO
2929import org .apache .spark .sql .Encoders
30- import org .apache .spark .sql .functions .sum
30+ import org .apache .spark .sql .functions .{ count , sum , isnull }
3131import org .locationtech .rasterframes ._
3232import org .locationtech .rasterframes .ref .RasterRef
3333import org .locationtech .rasterframes .tiles .ProjectedRasterTile
@@ -354,6 +354,17 @@ class TileFunctionsSpec extends TestEnvironment with RasterMatchers {
354354 t should be(randPRT.dimensions)
355355 checkDocs(" rf_dimensions" )
356356 }
357+
358+ it(" should get null for null tile dimensions" ) {
359+ val result = (Seq (randPRT) :+ null ).toDF(" tile" )
360+ .select(rf_dimensions($" tile" ) as " dim" )
361+ .select(isnull($" dim" ).cast(" long" ) as " n" )
362+ .agg(sum(" n" ), count(" n" ))
363+ .first()
364+ result.getAs[Long ](0 ) should be (1 )
365+ result.getAs[Long ](1 ) should be (2 )
366+ }
367+
357368 it(" should get the Extent of a ProjectedRasterTile" ) {
358369 val e = Seq (randPRT).toDF(" tile" ).select(rf_extent($" tile" )).first()
359370 e should be(extent)
You can’t perform that action at this time.
0 commit comments