Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8705771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:26:53+00:00 2026-06-13T03:26:53+00:00

For my map reduce job, I’m reading lines in my input file to get

  • 0

For my map reduce job, I’m reading lines in my input file to get external file paths. So my file that I’m using as input looks like:

/user/local/myfiles/temp1.png

/user/local/myfiles/temp2.jpg

/user/local/myfiles/temp3.txt

/user/local/myfiles/temp4.txt

....

And I want to perform some operation on those files. I need to grab the file object from the string path I read in my map function. My question is: where do I put the actual copy of those files so I can grab them? Do I put them on the hadoop dfs? When I put them on the local system, I get a file not found error but I get the same error when I put them on the hadoop file system (so every line in the input file is something like “/user/hadoop/input/temp1.txt”). I can get the file name, but I need to be able to get the image object or text file object from the path listed in the input file. Is there some way I can access a file on the dfs (or local system) from my map function given just a string path?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T03:26:55+00:00Added an answer on June 13, 2026 at 3:26 am

    You need to add them to the HDFS so that they are accessible from all Mappers. The following works for me (on 0.20):

            FileSystem fs = FileSystem.get(context.getConfiguration());
            FSDataInputStream in = null;
            BufferedReader br = null;
            String line = null;
    
            String file = context.getConfiguration().get(Constants.INFILE); 
            in = fs.open(new Path(file));
            br = new BufferedReader(new InputStreamReader(in));
            while((line=br.readLine())!=null)
    

    and I add the Constants.INFILE in the driver, in order not to hardcode the filenames into the code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple map/reduce job that scans one hbase table, and modifies another
I am using oozie to run my map-reduce job. I want to create the
Which is the difference between running a map reduce job doing /bin/hadoop -jar /file.jar
I'm trying to get OpenNLP integrated into a map-reduce job on Hadoop, starting with
I wrote a simple map reduce job that would read in data from the
I'm altering a hadoop map - reduce job that currently compiles and runs fine
What happens when the datanode the map/reduce is using goes down? Shouldnt the job
I'm rewriting a MongoDB map reduce job to use Hadoop instead (using the mongo-hadoop
I am using in-mapper combining in a Map Reduce job via the Python mrjob
I have a sequential file which is the output of hadoop map-reduce job. In

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.