DataFrame `toLayer` extension throws NPE with TileExploder and rf_assemble_tile
As originally reported on gitter and then discussed a bit more on stack overflow. There seems to be something generating a NullPointerException deep in the GT internals in the following situation:
-
transformaRasterFrameLayerin an ML pipeline withTileExploder, then - aggregate with
rf_assemble_tile -
.toLayer(tlm) -
.toRaster(...)<-- Throws NPE
Messing around some with the RasterFrameLayer at 3, I experimented with the toTileLayerRDD and was able to find that the RDD count exceeded the RasterFrameLayer count. I suspect toRaster and other methods are assuming the RasterFrameLayer is "complete", that it contains all SpatialKeys. But that toLayer does not provide that guarantee.
Note in addition to the work around in the SO answer, I was able to verify that the following case did not cause the bug: RasterFrameLayer.toDF().toLayer(tlm).toRaster(...). So something about the TileExploder and rf_assemble_tile may be afoot. I suspect this is all possible because there are entire Tiles in the layout that have entirely nodata, so no records are present on the dataframe at step 2.
