Return-Path: X-Original-To: apmail-hadoop-common-user-archive@www.apache.org Delivered-To: apmail-hadoop-common-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D6D682227 for ; Mon, 25 Apr 2011 10:38:52 +0000 (UTC) Received: (qmail 51327 invoked by uid 500); 25 Apr 2011 10:38:50 -0000 Delivered-To: apmail-hadoop-common-user-archive@hadoop.apache.org Received: (qmail 51188 invoked by uid 500); 25 Apr 2011 10:38:50 -0000 Mailing-List: contact common-user-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-user@hadoop.apache.org Delivered-To: mailing list common-user@hadoop.apache.org Received: (qmail 51180 invoked by uid 99); 25 Apr 2011 10:38:50 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Apr 2011 10:38:50 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of praveenesh@gmail.com designates 209.85.214.48 as permitted sender) Received: from [209.85.214.48] (HELO mail-bw0-f48.google.com) (209.85.214.48) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Apr 2011 10:38:44 +0000 Received: by bwz8 with SMTP id 8so2555627bwz.35 for ; Mon, 25 Apr 2011 03:38:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=frbADDbiOMGirzDqr709gFxScaGJv7KYXaDLMiKdhYw=; b=WbIXFeV0F88UbHkCGTo1qcaYud9Pq6A4mV3ZlwQnYbC5nX7KA5apoVo2nMY0uXBgvo NbgCyGEBndhBF9Vc2yAVMb0xsQh2aUFaAgsKnWzTRS4dhZNf6Lx8Zh2Rp4HCiB45gpJQ +KFTIs9ljrxJMvMozVJkqxccDZn6ed2wA9bsE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=fT5Qx/+lpRBAR5QH2tX/uHp+MDpyXAttmEgiHZGzvA3NNkbxsETHQ+OaWX981X6ghz hF2nM/7/azSM1uG5SoCEtpCgxmkB+7mJoZ0CdFzj2sxF7dv9aGmDEIGAnFVjRc3jJeOo aS63PdnBS2ndJmTegz6Hwjp7D+Jo6ISZruCFw= MIME-Version: 1.0 Received: by 10.204.22.205 with SMTP id o13mr3294927bkb.71.1303727903252; Mon, 25 Apr 2011 03:38:23 -0700 (PDT) Received: by 10.204.51.5 with HTTP; Mon, 25 Apr 2011 03:38:22 -0700 (PDT) In-Reply-To: References: Date: Mon, 25 Apr 2011 16:08:22 +0530 Message-ID: Subject: Re: Error while compiling the program From: praveenesh kumar To: common-user@hadoop.apache.org Content-Type: multipart/alternative; boundary=00032555a2e28eaed004a1bbceed --00032555a2e28eaed004a1bbceed Content-Type: text/plain; charset=ISO-8859-1 Thanks Joey..!! It compiled.. Regards, Praveenesh On Mon, Apr 25, 2011 at 3:47 PM, Joey Echeverria wrote: > Your delcaration of the Map class needs to include the input and > output types, e.g.: > > public static class Map extends MapReduceBase implements > Mapper { > ... > } > > -Joey > > On Mon, Apr 25, 2011 at 4:38 AM, praveenesh kumar > wrote: > > Hi, > > > > I am running the following code (Gender.java) on my hadoop . > > > > > > import java.io.IOException; > > import java.util.*; > > > > import org.apache.hadoop.fs.Path; > > import org.apache.hadoop.conf.*; > > import org.apache.hadoop.io.*; > > import org.apache.hadoop.mapred.*; > > import org.apache.hadoop.util.*; > > > > public class Gender { > > > > private static String genderCheck = "female"; > > > > public static class Map extends MapReduceBase implements Mapper { > > private final static IntWritable one = new IntWritable(1); > > private Text locText = new Text(); > > > > public void map(LongWritable key, Text value, OutputCollector > > output, Reporter reporter) throws IOException { > > String line = value.toString(); > > String location = line.split(",")[14] + "," + > > line.split(",")[15]; > > long male = 0L; > > long female = 0L; > > if (line.split(",")[17].matches("\d+") && > > line.split(",")[18].matches("\d+")) { > > male = Long.parseLong(line.split(",")[17]); > > female = Long.parseLong(line.split(",")[18]); > > } > > long diff = male - female; > > locText.set(location); > > if (Gender.genderCheck.toLowerCase().equals("female") && diff > < > > 0) { > > output.collect(locText, new LongWritable(diff * -1L)); > > } > > else if (Gender.genderCheck.toLowerCase().equals("male") && > diff > >> 0) { > > output.collect(locText, new > > LongWritable(diff)); > > } > > } > > } > > > > public static void main(String[] args) throws Exception { > > JobConf conf = new JobConf(Gender.class); > > conf.setJobName("gender"); > > conf.setOutputKeyClass(Text.class); > > conf.setOutputValueClass(LongWritable.class); > > conf.setMapperClass(Map.class); > > > > if (args.length != 3) { > > System.out.println("Usage:"); > > System.out.println("[male/female] /path/to/2kh/files > > /path/to/output"); > > System.exit(1); > > } > > > > if (!args[0].equalsIgnoreCase("male") && > > !args[0].equalsIgnoreCase("female")) { > > System.out.println("first argument must be male or female"); > > System.exit(1); > > } > > Gender.genderCheck = args[0]; > > > > conf.setInputFormat(TextInputFormat.class); > > conf.setOutputFormat(TextOutputFormat.class); > > FileInputFormat.setInputPaths(conf, new Path(args[1])); > > FileOutputFormat.setOutputPath(conf, new Path(args[2])); > > JobClient.runJob(conf); > > } > > > > } > > > > I am getting the following exception while compiling this : > > > > *Gender.java:14: Gender.Map is not abstract and does not override > abstract > > method > > > map(java.lang.Object,java.lang.Object,org.apache.hadoop.mapred.OutputCollector,org.apache.hadoop.mapred.Reporter) > > in org.apache.hadoop.mapred.Mapper > > public static class Map extends MapReduceBase implements Mapper { > > ^ > > Note: Gender.java uses or overrides a deprecated API. > > Note: Recompile with -Xlint:deprecation for details. > > Note: Gender.java uses unchecked or unsafe operations. > > Note: Recompile with -Xlint:unchecked for details. > > * > > Anyone suggest me how to debug this error ?? > > > > > > -- > Joseph Echeverria > Cloudera, Inc. > 443.305.9434 > --00032555a2e28eaed004a1bbceed--