Skip to content

Commit f375b0a

Browse files
committed
Add failing unit test for rf_explode_tiles_resample
Signed-off-by: Jason T. Brown <[email protected]>
1 parent 76badd7 commit f375b0a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

core/src/test/scala/astraea/spark/rasterframes/ExplodeSpec.scala

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,19 @@ class ExplodeSpec extends TestEnvironment with TestData {
6464
assert(exploded.count() < 9)
6565
}
6666

67+
it("should explode tiles with random sampling in SQL API") {
68+
val df = Seq[(Tile, Tile)]((byteArrayTile, byteArrayTile)).toDF("tile1", "tile2")
69+
val exploded = df.selectExpr("rf_explode_tiles_sample(0.5, tile1, tile2)")
70+
logger.info("rf_explode_tiles schema with double frac arg attempt" + exploded.schema.treeString)
71+
assert(exploded.columns.length === 4)
72+
assert(exploded.count() < 9)
73+
74+
val explodedSeed = df.selectExpr("rf_explode_tiles_sample(0.5, 784505, tile1, tile2)")
75+
assert(explodedSeed.columns.length === 4)
76+
logger.info(s"Count with seed 784505: ${explodedSeed.count().toString}")
77+
assert(explodedSeed.count() < 9)
78+
}
79+
6780
it("should handle null tiles") {
6881
val df = Seq[Tile](null, byteArrayTile, null, byteArrayTile, null).toDF("tile1")
6982
val exploded = df.select(explode_tiles($"tile1"))

0 commit comments

Comments
 (0)