@@ -44,6 +44,7 @@ class ExplodeSpec extends TestEnvironment with TestData {
4444 |""" .stripMargin)
4545 write(query)
4646 assert(query.select(" cell_0" , " cell_1" ).as[(Double , Double )].collect().forall(_ == ((1.0 , 2.0 ))))
47+ query.select(" cell_0" , " cell_1" ).count() should be (100L )
4748 val query2 = sql(
4849 """ |select rf_dimensions(tiles) as dims, rf_explode_tiles(tiles) from (
4950 |select rf_make_constant_tile(1, 10, 10, 'int8raw') as tiles)
@@ -66,6 +67,20 @@ class ExplodeSpec extends TestEnvironment with TestData {
6667 assert(exploded.count() < 9 )
6768 }
6869
70+ ignore(" should explode tiles with random sampling in SQL API" ) {
71+ // was pretty much a WONT FIX from issue 97
72+ val df = Seq [(Tile , Tile )]((byteArrayTile, byteArrayTile)).toDF(" tile1" , " tile2" )
73+ val exploded = df.selectExpr(" rf_explode_tiles_sample(0.5, tile1, tile2)" )
74+ logger.info(" rf_explode_tiles schema with double frac arg \n " + exploded.schema.treeString)
75+ assert(exploded.columns.length === 4 )
76+ assert(exploded.count() < 9 )
77+
78+ val explodedSeed = df.selectExpr(" rf_explode_tiles_sample(0.5, 784505, tile1, tile2)" )
79+ assert(explodedSeed.columns.length === 4 )
80+ logger.info(s " Count with seed 784505: ${explodedSeed.count().toString}" )
81+ assert(explodedSeed.count() < 9 )
82+ }
83+
6984 it(" should handle null tiles" ) {
7085 val df = Seq [Tile ](null , byteArrayTile, null , byteArrayTile, null ).toDF(" tile1" )
7186 val exploded = df.select(rf_explode_tiles($" tile1" ))
0 commit comments