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

  • SEARCH
  • Home
  • 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 9059731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:02:54+00:00 2026-06-16T15:02:54+00:00

I have developed a code that runs a map reduce job to read files

  • 0

I have developed a code that runs a map reduce job to read files from FTP server and write it into HDFS. Into HDFS it writes the file from FTP into the specified output directory naming it as part-0000. In case I have multiple files on the FTP server I get all of them written to that one part-0000 file in HDFS.

To avoid this I plan to pass the name of the file as key along with the data as value . Thus the reducer gets the data into an output file with the key as the name of the file.

I understand that I have to use an outputformat that extends MultipleTextOutputFormat. I have written it as follows

 static class MultiFileOutput extends MultipleTextOutputFormat<Text, Text> {

         protected String generateFileNameForKeyValue(Text key, Text value,String name) {
            System.out.println("key is :"+ key.toString());
         System.out.println("value is :"+ value.toString());
            System.out.println("name is :"+ name.toString());

                 return key.toString();
         }

But I fail to pass the name of the input file being processed . How do I get the name of the input file ?

map.input.file

and

FileSystem fs = file.getFileSystem(conf);
                String fileName=fs.getName();

do not return the name of the input file.

Any pointers ?

  • 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-16T15:02:55+00:00Added an answer on June 16, 2026 at 3:02 pm

    I used FileStatus object in the following code as my customised input format would not split the input file. It worked fine for me ..

     FileSystem fs = file.getFileSystem(conf);
                        FileStatus status= fs.getFileStatus(file);
                        String fileName=status.getPath().toString();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have developed code on a m-file script in Matlab that communicates with a
I have some ANSI C code that I developed on my Mac, but when
I have developed a VB.Net code for retrieving data from excel file .I load
I have Ubuntu 8.04 running on a Xen based VPS server that runs on
I have developed an application that runs every day once. In that I want
I have developed a Facebook application that runs inside an iframe in the Facebook
i have developed an app that runs perfectly fine on the simulator but when
I have developed a web application, which runs good when executed from Visual studio.
I have a section of C# code within my nant build script that runs
I have developed a simple application that uses APNS. The app runs fine and

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.