Giving filename as key to mapper ?

2011-07-15 Thread praveenesh kumar
Hi, How can I give filename as key to mapper ? I want to know the occurence of word in set of docs, so I want to keep key as filename. Is it possible to give input key as filename in map function ? Thanks, Praveenesh

Re: Giving filename as key to mapper ?

2011-07-15 Thread Harsh J
You can retrieve the filename in the new API as described here: http://search-hadoop.com/m/ZOmmJ1PZJqt1/map+input+filenamesubj=Retrieving+Filename In the old API, its available in the configuration instance of the mapper as key map.input.file. See the table below this section

Re: Giving filename as key to mapper ?

2011-07-15 Thread Robert Evans
To add to that if you really want the file name to be the key instead of just calling a different API in your map to get it you will probably need to write your own input format to do it. It should be fairly simple and you can base it off of an existing input format to do it. --Bobby On

Re: Giving filename as key to mapper ?

2011-07-15 Thread praveenesh kumar
I am new to this hadoop API. Can anyone give me some tutorial or code snipet on how to write your own input format to do these kind of things. Thanks. On Fri, Jul 15, 2011 at 8:07 PM, Robert Evans ev...@yahoo-inc.com wrote: To add to that if you really want the file name to be the key instead

RE: Giving filename as key to mapper ?

2011-07-15 Thread GOEKE, MATTHEW (AG/1000)
: The Definitive Guide. Matt -Original Message- From: praveenesh kumar [mailto:praveen...@gmail.com] Sent: Friday, July 15, 2011 9:42 AM To: common-user@hadoop.apache.org Subject: Re: Giving filename as key to mapper ? I am new to this hadoop API. Can anyone give me some tutorial or code