@@ -32,40 +32,38 @@ class QueryPartitionSuite extends QueryTest with SQLTestUtils with TestHiveSingl
3232 import spark .implicits ._
3333
3434 test(" SPARK-5068: query data when path doesn't exist" ) {
35- withSQLConf((SQLConf .HIVE_VERIFY_PARTITION_PATH .key, " true" )) {
36- val testData = sparkContext.parallelize(
37- (1 to 10 ).map(i => TestData (i, i.toString))).toDF()
38- testData.createOrReplaceTempView(" testData" )
35+ val testData = sparkContext.parallelize(
36+ (1 to 10 ).map(i => TestData (i, i.toString))).toDF()
37+ testData.createOrReplaceTempView(" testData" )
3938
40- val tmpDir = Files .createTempDir()
41- // create the table for test
42- sql(s " CREATE TABLE table_with_partition(key int,value string) " +
43- s " PARTITIONED by (ds string) location ' ${tmpDir.toURI}' " )
44- sql(" INSERT OVERWRITE TABLE table_with_partition partition (ds='1') " +
45- " SELECT key,value FROM testData" )
46- sql(" INSERT OVERWRITE TABLE table_with_partition partition (ds='2') " +
47- " SELECT key,value FROM testData" )
48- sql(" INSERT OVERWRITE TABLE table_with_partition partition (ds='3') " +
49- " SELECT key,value FROM testData" )
50- sql(" INSERT OVERWRITE TABLE table_with_partition partition (ds='4') " +
51- " SELECT key,value FROM testData" )
39+ val tmpDir = Files .createTempDir()
40+ // create the table for test
41+ sql(s " CREATE TABLE table_with_partition(key int,value string) " +
42+ s " PARTITIONED by (ds string) location ' ${tmpDir.toURI}' " )
43+ sql(" INSERT OVERWRITE TABLE table_with_partition partition (ds='1') " +
44+ " SELECT key,value FROM testData" )
45+ sql(" INSERT OVERWRITE TABLE table_with_partition partition (ds='2') " +
46+ " SELECT key,value FROM testData" )
47+ sql(" INSERT OVERWRITE TABLE table_with_partition partition (ds='3') " +
48+ " SELECT key,value FROM testData" )
49+ sql(" INSERT OVERWRITE TABLE table_with_partition partition (ds='4') " +
50+ " SELECT key,value FROM testData" )
5251
53- // test for the exist path
54- checkAnswer(sql(" select key,value from table_with_partition" ),
55- testData.toDF.collect ++ testData.toDF.collect
56- ++ testData.toDF.collect ++ testData.toDF.collect)
52+ // test for the exist path
53+ checkAnswer(sql(" select key,value from table_with_partition" ),
54+ testData.toDF.collect ++ testData.toDF.collect
55+ ++ testData.toDF.collect ++ testData.toDF.collect)
5756
58- // delete the path of one partition
59- tmpDir.listFiles
60- .find { f => f.isDirectory && f.getName().startsWith(" ds=" ) }
61- .foreach { f => Utils .deleteRecursively(f) }
57+ // delete the path of one partition
58+ tmpDir.listFiles
59+ .find { f => f.isDirectory && f.getName().startsWith(" ds=" ) }
60+ .foreach { f => Utils .deleteRecursively(f) }
6261
63- // test for after delete the path
64- checkAnswer(sql(" select key,value from table_with_partition" ),
65- testData.toDF.collect ++ testData.toDF.collect ++ testData.toDF.collect)
62+ // test for after delete the path
63+ checkAnswer(sql(" select key,value from table_with_partition" ),
64+ testData.toDF.collect ++ testData.toDF.collect ++ testData.toDF.collect)
6665
67- sql(" DROP TABLE IF EXISTS table_with_partition" )
68- sql(" DROP TABLE IF EXISTS createAndInsertTest" )
69- }
66+ sql(" DROP TABLE IF EXISTS table_with_partition" )
67+ sql(" DROP TABLE IF EXISTS createAndInsertTest" )
7068 }
7169}
0 commit comments