@@ -213,7 +213,7 @@ class ParquetSchemaPruningSuite
213213 MixedCase (1 , " r1c1" , MixedCaseColumn (" 123" , 2 )) ::
214214 Nil
215215
216- testExactCasePruning (" select with exact column names" ) {
216+ testExactCaseQueryPruning (" select with exact column names" ) {
217217 val query = sql(" select CoL1, coL2.B from mixedcase" )
218218 checkScan(query, " struct<CoL1:string,coL2:struct<B:int>>" )
219219 checkAnswer(query.orderBy(" id" ),
@@ -222,7 +222,7 @@ class ParquetSchemaPruningSuite
222222 Nil )
223223 }
224224
225- testMixedCasePruning (" select with lowercase column names" ) {
225+ testMixedCaseQueryPruning (" select with lowercase column names" ) {
226226 val query = sql(" select col1, col2.b from mixedcase" )
227227 checkScan(query, " struct<CoL1:string,coL2:struct<B:int>>" )
228228 checkAnswer(query.orderBy(" id" ),
@@ -231,7 +231,7 @@ class ParquetSchemaPruningSuite
231231 Nil )
232232 }
233233
234- testMixedCasePruning (" select with different-case column names" ) {
234+ testMixedCaseQueryPruning (" select with different-case column names" ) {
235235 val query = sql(" select cOL1, cOl2.b from mixedcase" )
236236 checkScan(query, " struct<CoL1:string,coL2:struct<B:int>>" )
237237 checkAnswer(query.orderBy(" id" ),
@@ -240,7 +240,7 @@ class ParquetSchemaPruningSuite
240240 Nil )
241241 }
242242
243- testMixedCasePruning (" filter with different-case column names" ) {
243+ testMixedCaseQueryPruning (" filter with different-case column names" ) {
244244 val query = sql(" select id from mixedcase where Col2.b = 2" )
245245 // Pruning with filters is currently unsupported. As-is, the file reader will read the id column
246246 // and the entire coL2 struct. Once pruning with filters has been implemented we can uncomment
@@ -249,7 +249,10 @@ class ParquetSchemaPruningSuite
249249 checkAnswer(query.orderBy(" id" ), Row (1 ) :: Nil )
250250 }
251251
252- private def testExactCasePruning (testName : String )(testThunk : => Unit ) {
252+ // Tests schema pruning for a query whose column and field names are exactly the same as the table
253+ // schema's column and field names. N.B. this implies that `testThunk` should pass using either a
254+ // case-sensitive or case-insensitive query parser
255+ private def testExactCaseQueryPruning (testName : String )(testThunk : => Unit ) {
253256 test(s " Spark vectorized reader - case-sensitive parser - mixed-case schema - $testName" ) {
254257 withSQLConf(SQLConf .PARQUET_VECTORIZED_READER_ENABLED .key -> " true" ,
255258 SQLConf .CASE_SENSITIVE .key -> " true" ) {
@@ -262,18 +265,20 @@ class ParquetSchemaPruningSuite
262265 withMixedCaseData(testThunk)
263266 }
264267 }
265- testMixedCasePruning (testName)(testThunk)
268+ testMixedCaseQueryPruning (testName)(testThunk)
266269 }
267270
268- private def testMixedCasePruning (testName : String )(testThunk : => Unit ) {
269- test(s " Parquet-mr reader - case-insensitive parser - mixed-case schema - $testName" ) {
270- withSQLConf(SQLConf .PARQUET_VECTORIZED_READER_ENABLED .key -> " false" ,
271+ // Tests schema pruning for a query whose column and field names may differ in case from the table
272+ // schema's column and field names
273+ private def testMixedCaseQueryPruning (testName : String )(testThunk : => Unit ) {
274+ test(s " Spark vectorized reader - case-insensitive parser - mixed-case schema - $testName" ) {
275+ withSQLConf(SQLConf .PARQUET_VECTORIZED_READER_ENABLED .key -> " true" ,
271276 SQLConf .CASE_SENSITIVE .key -> " false" ) {
272277 withMixedCaseData(testThunk)
273278 }
274279 }
275- test(s " Spark vectorized reader - case-insensitive parser - mixed-case schema - $testName" ) {
276- withSQLConf(SQLConf .PARQUET_VECTORIZED_READER_ENABLED .key -> " true " ,
280+ test(s " Parquet-mr reader - case-insensitive parser - mixed-case schema - $testName" ) {
281+ withSQLConf(SQLConf .PARQUET_VECTORIZED_READER_ENABLED .key -> " false " ,
277282 SQLConf .CASE_SENSITIVE .key -> " false" ) {
278283 withMixedCaseData(testThunk)
279284 }
0 commit comments