File tree Expand file tree Collapse file tree 2 files changed +10
-10
lines changed
main/scala/org/apache/spark/sql/hive/execution
test/scala/org/apache/spark/sql/hive Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -107,11 +107,11 @@ case class InsertIntoHiveTable(
107107 // SPARK-20594: This is a walk-around fix to resolve a Hive bug. Hive requires that the
108108 // staging directory needs to avoid being deleted when users set hive.exec.stagingdir
109109 // under the table directory.
110- if (FileUtils .isSubDir(new Path (stagingPathName), inputPath, fs)
111- && ! stagingPathName.stripPrefix(inputPathName).stripPrefix(File .separator).startsWith(" ." )) {
110+ if (FileUtils .isSubDir(new Path (stagingPathName), inputPath, fs) &&
111+ ! stagingPathName.stripPrefix(inputPathName).stripPrefix(File .separator).startsWith(" ." )) {
112112 logDebug(s " The staging dir ' $stagingPathName' should be a child directory starts " +
113- s " with '.' to avoid being deleted if we set hive.exec.stagingdir under the table " +
114- s " directory. " )
113+ " with '.' to avoid being deleted if we set hive.exec.stagingdir under the table " +
114+ " directory." )
115115 stagingPathName = new Path (inputPathName, " .hive-staging" ).toString
116116 }
117117
Original file line number Diff line number Diff line change @@ -500,7 +500,7 @@ class InsertIntoHiveTableSuite extends QueryTest with TestHiveSingleton with Bef
500500 |staging directory needs to avoid being deleted when users set hive.exec.stagingdir
501501 |under the table directory.""" .stripMargin) {
502502
503- withTable(" test_table" , " test_table1 " ) {
503+ withTable(" test_table" ) {
504504 spark.range(1 ).write.saveAsTable(" test_table" )
505505
506506 // Make sure the table has also been updated.
@@ -509,19 +509,19 @@ class InsertIntoHiveTableSuite extends QueryTest with TestHiveSingleton with Bef
509509 Row (0 )
510510 )
511511
512- sql(" CREATE TABLE test_table1 (key int)" )
513-
514512 // Set hive.exec.stagingdir under the table directory without start with ".".
515513 sql(" set hive.exec.stagingdir=./test" )
516514
517515 // Now overwrite.
518- sql(" INSERT OVERWRITE TABLE test_table1 SELECT * FROM test_table " )
516+ sql(" INSERT OVERWRITE TABLE test_table SELECT 1 " )
519517
520518 // Make sure the table has also been updated.
521519 checkAnswer(
522- sql(" SELECT * FROM test_table1 " ),
523- Row (0 )
520+ sql(" SELECT * FROM test_table " ),
521+ Row (1 )
524522 )
523+
524+ sql(" reset" )
525525 }
526526 }
527527}
You can’t perform that action at this time.
0 commit comments