Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -610,10 +610,10 @@ case class AlterTableRecoverPartitionsCommand(

val root = new Path(table.location)
logInfo(s"Recover all the partitions in $root")
val fs = root.getFileSystem(spark.sparkContext.hadoopConfiguration)
val hadoopConf = spark.sessionState.newHadoopConf()
val fs = root.getFileSystem(hadoopConf)

val threshold = spark.conf.get("spark.rdd.parallelListingThreshold", "10").toInt
val hadoopConf = spark.sparkContext.hadoopConfiguration
val pathFilter = getPathFilter(hadoopConf)

val evalPool = ThreadUtils.newForkJoinPool("AlterTableRecoverPartitionsCommand", 8)
Expand Down Expand Up @@ -697,7 +697,7 @@ case class AlterTableRecoverPartitionsCommand(
pathFilter: PathFilter,
threshold: Int): GenMap[String, PartitionStatistics] = {
if (partitionSpecsAndLocs.length > threshold) {
val hadoopConf = spark.sparkContext.hadoopConfiguration
val hadoopConf = spark.sessionState.newHadoopConf()
val serializableConfiguration = new SerializableConfiguration(hadoopConf)
val serializedPaths = partitionSpecsAndLocs.map(_._2.toString).toArray

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ private[sql] class SessionState(
private[sql] object SessionState {
def newHadoopConf(hadoopConf: Configuration, sqlConf: SQLConf): Configuration = {
val newHadoopConf = new Configuration(hadoopConf)
sqlConf.getAllConfs.foreach { case (k, v) => if (v ne null) newHadoopConf.set(k, v) }
sqlConf.getAllConfs.foreach { case (k, v) =>
if (v ne null) newHadoopConf.set(k, v.stripPrefix("spark.hadoop"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add a test case for this feature?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just reverted this part, it's not really related to the rest.

}
newHadoopConf
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -518,8 +518,9 @@ private[hive] class TestHiveSparkSession(
// an HDFS scratch dir: ${hive.exec.scratchdir}/<username> is created, with
// ${hive.scratch.dir.permission}. To resolve the permission issue, the simplest way is to
// delete it. Later, it will be re-created with the right permission.
val location = new Path(sc.hadoopConfiguration.get(ConfVars.SCRATCHDIR.varname))
val fs = location.getFileSystem(sc.hadoopConfiguration)
val hadoopConf = sessionState.newHadoopConf()
val location = new Path(hadoopConf.get(ConfVars.SCRATCHDIR.varname))
val fs = location.getFileSystem(hadoopConf)
fs.delete(location, true)

// Some tests corrupt this value on purpose, which breaks the RESET call below.
Expand Down