File tree Expand file tree Collapse file tree 3 files changed +23
-2
lines changed
main/scala/org/locationtech/rasterframes/extensions
test/scala/org/locationtech/rasterframes Expand file tree Collapse file tree 3 files changed +23
-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 @@ -172,6 +172,16 @@ class RasterJoinSpec extends TestEnvironment with TestData with RasterMatchers {
172172 }
173173 }
174174
175+ it(" should raster join multiple times on projected raster" ){
176+ val df0 = Seq (one).toDF(" proj_raster" )
177+ val result = df0.select($" proj_raster" as " t1" )
178+ .rasterJoin(df0.select($" proj_raster" as " t2" ))
179+ .rasterJoin(df0.select($" proj_raster" as " t3" ))
180+
181+ result.tileColumns.length should be (3 )
182+ result.count() should be (1 )
183+ }
184+
175185 it(" should honor resampling options" ) {
176186 // test case. replicate existing test condition and check that resampling option results in different output
177187 val filterExpr = st_intersects(rf_geometry($" tile" ), st_point(704940.0 , 4251130.0 ))
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