Github user mccheah commented on a diff in the pull request:
https://github.com/apache/spark/pull/4106#discussion_r25227412
--- Diff: core/src/main/scala/org/apache/spark/rdd/HadoopRDD.scala ---
@@ -193,17 +193,21 @@ class HadoopRDD[K, V](
override def getPartitions: Array[Partition] = {
val jobConf = getJobConf()
// add the credentials here as this can be called before SparkContext
initialized
+ // Also need to explicitly run this as the Spark user to pick up
permissions -
+ // the driver does not invoke runAsSparkUser elsewhere, unlike the
executors
SparkHadoopUtil.get.addCredentials(jobConf)
- val inputFormat = getInputFormat(jobConf)
- if (inputFormat.isInstanceOf[Configurable]) {
- inputFormat.asInstanceOf[Configurable].setConf(jobConf)
- }
- val inputSplits = inputFormat.getSplits(jobConf, minPartitions)
- val array = new Array[Partition](inputSplits.size)
- for (i <- 0 until inputSplits.size) {
- array(i) = new HadoopPartition(id, i, inputSplits(i))
- }
- array
+ SparkHadoopUtil.get.runAsSparkUser(() => {
--- End diff --
Ah - if the YARN Client executes this code, it already inherits the
permissions set up by the YARN environment, which makes running this
unnecessary. Whereas if this is run in standalone mode, we need to explicitly
run this code as the YARN User at the driver.
I don't want to wrap all of SparkContext.runJob in a runAsSparkUser call.
We might as well localize the things that need HDFS permissions to the bits of
code that actually need it.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]