@@ -367,10 +367,9 @@ class OrcQuerySuite extends QueryTest with BeforeAndAfterAll with OrcTest {
367367 val path = dir.getCanonicalPath
368368
369369 // For field "a", the first column has odds integers. This is to check the filtered count
370- // when `isNull` is performed.
371- // For Field "b", `isNotNull` of ORC file filters rows only when all the values are
372- // null (maybe this works differently when the data or query is complicated).
373- // So, simply here a column only having `null` is added.
370+ // when `isNull` is performed. For Field "b", `isNotNull` of ORC file filters rows
371+ // only when all the values are null (maybe this works differently when the data
372+ // or query is complicated). So, simply here a column only having `null` is added.
374373 val data = (0 until 10 ).map { i =>
375374 val maybeInt = if (i % 2 == 0 ) None else Some (i)
376375 val nullValue : Option [String ] = None
@@ -379,33 +378,33 @@ class OrcQuerySuite extends QueryTest with BeforeAndAfterAll with OrcTest {
379378 createDataFrame(data).toDF(" a" , " b" ).write.orc(path)
380379 val df = sqlContext.read.orc(path)
381380
382- def checkPredicate (pred : Column , answer : Seq [Any ]): Unit = {
381+ def checkPredicate (pred : Column , answer : Seq [Row ]): Unit = {
383382 val sourceDf = extractSourceRDDToDataFrame(df.where(pred))
384383 val data = sourceDf.collect().toSet
385- val expectedData = answer.map( Row (_, null )). toSet
384+ val expectedData = answer.toSet
386385
387- // The result should be single row. When a filter is pushed to ORC, ORC can apply it to
388- // every row. So, we can check the number of rows returned from the ORC to make sure
389- // our filter pushdown work. A tricky part is, ORC does not process filter fully but
390- // return some possible results. So, the number is checked if it is less than
391- // the original count , and then checks if it contains the expected value .
386+ // When a filter is pushed to ORC, ORC can apply it to rows. So, we can check
387+ // the number of rows returned from the ORC to make sure our filter pushdown work.
388+ // A tricky part is, ORC does not process filter rows fully but return some possible
389+ // results. So, this checks if the number of result is less than the original count
390+ // of data , and then checks if it contains the expected data .
392391 val isOrcFiltered = sourceDf.count < 10 && expectedData.subsetOf(data)
393392 assert(isOrcFiltered)
394393 }
395394
396- checkPredicate(' a === 5 , Seq ( 5 ))
397- checkPredicate(' a <=> 5 , Seq ( 5 ))
398- checkPredicate(' a < 5 , Seq (1 , 3 ))
399- checkPredicate(' a <= 5 , Seq (1 , 3 , 5 ))
400- checkPredicate(' a > 5 , Seq (7 , 9 ))
401- checkPredicate(' a >= 5 , Seq (5 , 7 , 9 ))
402- checkPredicate(' a .isNull, Seq (null ))
403- checkPredicate(' b .isNotNull, Seq ())
404- checkPredicate(' a .isin(3 , 5 , 7 ), Seq (3 , 5 , 7 ))
405- checkPredicate(' a > 0 && ' a < 3 , Seq ( 1 ))
406- checkPredicate(' a < 1 || ' a > 8 , Seq ( 9 ))
407- checkPredicate(! (' a > 3 ), Seq (1 , 3 ))
408- checkPredicate(! (' a > 0 && ' a < 3 ), Seq (3 , 5 , 7 , 9 ))
395+ checkPredicate(' a === 5 , List ( 5 ).map( Row (_, null ) ))
396+ checkPredicate(' a <=> 5 , List ( 5 ).map( Row (_, null ) ))
397+ checkPredicate(' a < 5 , List (1 , 3 ).map( Row (_, null ) ))
398+ checkPredicate(' a <= 5 , List (1 , 3 , 5 ).map( Row (_, null ) ))
399+ checkPredicate(' a > 5 , List (7 , 9 ).map( Row (_, null ) ))
400+ checkPredicate(' a >= 5 , List (5 , 7 , 9 ).map( Row (_, null ) ))
401+ checkPredicate(' a .isNull, List (null ).map( Row (_, null ) ))
402+ checkPredicate(' b .isNotNull, List ())
403+ checkPredicate(' a .isin(3 , 5 , 7 ), List (3 , 5 , 7 ).map( Row (_, null ) ))
404+ checkPredicate(' a > 0 && ' a < 3 , List ( 1 ).map( Row (_, null ) ))
405+ checkPredicate(' a < 1 || ' a > 8 , List ( 9 ).map( Row (_, null ) ))
406+ checkPredicate(! (' a > 3 ), List (1 , 3 ).map( Row (_, null ) ))
407+ checkPredicate(! (' a > 0 && ' a < 3 ), List (3 , 5 , 7 , 9 ).map( Row (_, null ) ))
409408 }
410409 }
411410 }
0 commit comments