spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xu (Simon) Chen" <>
Subject Re: access hdfs file name in map()
Date Fri, 01 Aug 2014 17:42:34 GMT
Hi Roberto,

Ultimately, the info you need is set here:

Being a spark newbie, I extended org.apache.spark.rdd.HadoopRDD class as
HadoopRDDWithEnv, which takes in an additional parameter (varname) in the
constructor, then override the compute() function to return something like
"""split.getPipeEnvVars.getOrElse(varName, "") + "|" + value.toString()"""
as the value. This obviously is less general and makes certain assumptions
about the input data. Also you need to write several wrappers in
SparkContext, so that you can do something like sc.textFileWithEnv("hdfs
path", "mapreduce_map_input_file").

I was hoping to do something like
"{print\"${mapreduce_map_input_file}\",$0}" """). This gives me some weird
kyro buffer overflow exception... Haven't got a chance to look into the
details yet.


On Fri, Aug 1, 2014 at 7:38 AM, Roberto Torella <>

> Hi Simon,
> I'm trying to do the same but I'm quite lost.
> How did you do that? (Too direct? :)
> Thanks and ciao,
> r-
> --
> View this message in context:
> Sent from the Apache Spark User List mailing list archive at

View raw message