Github user pwendell commented on a diff in the pull request:
https://github.com/apache/spark/pull/94#discussion_r10364651
--- Diff: core/src/main/scala/org/apache/spark/rdd/PipedRDD.scala ---
@@ -59,6 +61,20 @@ class PipedRDD[T: ClassTag](
val currentEnvVars = pb.environment()
envVars.foreach { case (variable, value) =>
currentEnvVars.put(variable, value) }
+ // for compatibility with Hadoop which sets these env variables
+ // so the user code can access the input filename
+ if (split.isInstanceOf[HadoopPartition]) {
+ val hadoopSplit = split.asInstanceOf[HadoopPartition]
+
+ if (hadoopSplit.inputSplit.value.isInstanceOf[FileSplit]) {
+ val is: FileSplit =
hadoopSplit.inputSplit.value.asInstanceOf[FileSplit]
+ // map.input.file is deprecated in favor of
mapreduce.map.input.file but set both
--- End diff --
tiny nit: but mind saying `map_input_file` etc here (using underscores and
not periods). Otherwise it's sorta confusing because it looks like these are
hadoop conf options.
---
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.
---