hadoop-hdfs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <schhajed....@gmail.com>
Subject Re: Where to begin from??
Date Sat, 25 May 2013 06:18:44 GMT
Did you try using MultipleOutputs Class.

Sent from Windows Mail

From: Sanjay Subramanian
Sent: ‎Friday‎, ‎24‎ ‎May‎ ‎2013 ‎11‎:‎13‎ ‎PM
To: user@hadoop.apache.org

Hey guys 

Is there a way to dynamically change the input dir and outputdir

I have the following CONSTANT directories in HDFS 
/path/to/input/9999-99-99 (empty directory )
/path/to/output/9999-99-99 (empty directory)

A new directory with yesterdays date like /path/to/input/2013-05-23 gets created every day

I set the job params



But in my Mapper I thought I can sneak in this code….But it does not work ?

    protected void setup(Context context)

            throws IOException,


org.apache.hadoop.conf.Configuration hadoopConf = ((JobContext)context).getConfiguration();

String inputDir = hadoopConf.get("mapreduce.input.fileinputformat.inputdir");

String outputDir = hadoopConf.get("mapreduce.output.fileoutputformat.outputdir");

String yesterdaysDate =DateUtils.getDayYYYYMMDD("-", -1);

String inputDirUseThis = inputDir.replaceAll("9999-99-99", yesterdaysDate);

String outputDirUseThis = inputDir.replaceAll("9999-99-99", yesterdaysDate);







This email message and any attachments are for the exclusive use of the intended recipient(s)
and may contain confidential and privileged information. Any unauthorized review, use, disclosure
or distribution is prohibited. If you are not the intended recipient, please contact the sender
by reply email and destroy all copies of the original message along with any attachments,
from your computer system. If you are the intended recipient, please be advised that the content
of this message is subject to access, review and disclosure by the sender's Email System Administrator.
View raw message