@@ -254,7 +254,11 @@ class FilteredScanSuite extends DataSourceTest with SharedSQLContext with Predic
254254 testPushDown(" SELECT * FROM oneToTenFiltered WHERE a IN (1,3,5)" , 3 , Set (" a" , " b" , " c" ))
255255
256256 testPushDown(" SELECT * FROM oneToTenFiltered WHERE a = 20" , 0 , Set (" a" , " b" , " c" ))
257- testPushDown(" SELECT * FROM oneToTenFiltered WHERE b = 1" , 10 , Set (" a" , " b" , " c" ))
257+ testPushDown(
258+ " SELECT * FROM oneToTenFiltered WHERE b = 1" ,
259+ 10 ,
260+ Set (" a" , " b" , " c" ),
261+ Set (EqualTo (" b" , 1 )))
258262
259263 testPushDown(" SELECT * FROM oneToTenFiltered WHERE a < 5 AND a > 1" , 3 , Set (" a" , " b" , " c" ))
260264 testPushDown(" SELECT * FROM oneToTenFiltered WHERE a < 3 OR a > 8" , 4 , Set (" a" , " b" , " c" ))
@@ -283,12 +287,23 @@ class FilteredScanSuite extends DataSourceTest with SharedSQLContext with Predic
283287 | WHERE a + b > 9
284288 | AND b < 16
285289 | AND c IN ('bbbbbBBBBB', 'cccccCCCCC', 'dddddDDDDD', 'foo')
286- """ .stripMargin.split(" \n " ).map(_.trim).mkString(" " ), 3 , Set (" a" , " b" ))
290+ """ .stripMargin.split(" \n " ).map(_.trim).mkString(" " ),
291+ 3 ,
292+ Set (" a" , " b" ),
293+ Set (LessThan (" b" , 16 )))
287294
288295 def testPushDown (
289- sqlString : String ,
290- expectedCount : Int ,
291- requiredColumnNames : Set [String ]): Unit = {
296+ sqlString : String ,
297+ expectedCount : Int ,
298+ requiredColumnNames : Set [String ]): Unit = {
299+ testPushDown(sqlString, expectedCount, requiredColumnNames, Set .empty[Filter ])
300+ }
301+
302+ def testPushDown (
303+ sqlString : String ,
304+ expectedCount : Int ,
305+ requiredColumnNames : Set [String ],
306+ expectedUnhandledFilters : Set [Filter ]): Unit = {
292307 test(s " PushDown Returns $expectedCount: $sqlString" ) {
293308 val queryExecution = sql(sqlString).queryExecution
294309 val rawPlan = queryExecution.executedPlan.collect {
@@ -300,15 +315,13 @@ class FilteredScanSuite extends DataSourceTest with SharedSQLContext with Predic
300315 val rawCount = rawPlan.execute().count()
301316 assert(ColumnsRequired .set === requiredColumnNames)
302317
303- assert {
304- val table = caseInsensitiveContext.table(" oneToTenFiltered" )
305- val relation = table.queryExecution.logical.collectFirst {
306- case LogicalRelation (r, _) => r
307- }.get
318+ val table = caseInsensitiveContext.table(" oneToTenFiltered" )
319+ val relation = table.queryExecution.logical.collectFirst {
320+ case LogicalRelation (r, _) => r
321+ }.get
308322
309- // `relation` should be able to handle all pushed filters
310- relation.unhandledFilters(FiltersPushed .list.toArray).isEmpty
311- }
323+ assert(
324+ relation.unhandledFilters(FiltersPushed .list.toArray).toSet === expectedUnhandledFilters)
312325
313326 if (rawCount != expectedCount) {
314327 fail(
0 commit comments