You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-user@hadoop.apache.org by Vijay Bharath Reddy <vi...@gmail.com> on 2009/09/17 20:17:02 UTC
reg : my OutputFormat class cannot recognize my WritableComparable
class
Hi,
I'm writing my own OutputFormat class and I faced the folloeing errors.
-- public class KeyDoc implements WritableComparable{
this is my WritableComparable implementation...
-- public class KeyDocOutputFormat<KeyDoc,IntWritable> implements
OutputFormat<KeyDoc,IntWritable>{
this is my OutputFormat implementation...
In this KeyDocOutputFormat class I implemented RecordWriter ..
-- public static class MyRecordWriter<KeyDoc, IntWritable>
implements RecordWriter<KeyDoc, IntWritable>{
In this RecordWriter my write function goes like
this...
-- public synchronized void write(KeyDoc kd,
IntWritable v) throws IOException{
And in this function when I'm accessing the KeyDoc attributes compiler is
shooting the following error..
KeyDocOutputFormat.java:55: cannot find symbol
symbol : method get(java.lang.String)
location: class java.lang.Object
out.write(kd.get("docTitle"));
Its considering the kd as an Object not as an KeyDoc... So for checking this
I gave.....
if(kd instanceof KeyDoc)
out.write(kd.get("word"));
then the error is ....
KeyDocOutputFormat.java:50: unexpected type
found : KeyDoc
required: class or array
if(kd instanceof KeyDoc)
Can someone help me in debugging it .....
--
vJay
PS :: I attached the source code..
Re: reg : my OutputFormat class cannot recognize my
WritableComparable class
Posted by Vijay Bharath Reddy <vi...@gmail.com>.
thanks for the reply.
I sorted it out by replacing all *<KeyDoc, IntWritable>* with *<K, V>* ...
vJay.
On Fri, Sep 18, 2009 at 1:08 AM, Jeyendran Balakrishnan <
jbalakrishnan@docomolabs-usa.com> wrote:
> Try replacing your class definitions to:
>
> public class KeyDocOutputFormat implements
> OutputFormat<KeyDoc,IntWritable>{
> and
>
> public static class MyRecordWriter implements RecordWriter<KeyDoc,
> IntWritable>{
>
>
>
> ________________________________
>
> From: Vijay Bharath Reddy [mailto:vijaybharathenator@gmail.com]
> Sent: Thursday, September 17, 2009 11:17 AM
> To: common-user@hadoop.apache.org
> Subject: reg : my OutputFormat class cannot recognize my
> WritableComparable class
>
>
>
>
> Hi,
>
> I'm writing my own OutputFormat class and I faced the folloeing errors.
>
> -- public class KeyDoc implements WritableComparable{
>
> this is my WritableComparable implementation...
>
> -- public class KeyDocOutputFormat<KeyDoc,IntWritable> implements
> OutputFormat<KeyDoc,IntWritable>{
>
> this is my OutputFormat implementation...
>
> In this KeyDocOutputFormat class I implemented RecordWriter ..
>
> -- public static class MyRecordWriter<KeyDoc,
> IntWritable> implements RecordWriter<KeyDoc, IntWritable>{
>
> In this RecordWriter my write function goes like
> this...
>
> -- public synchronized void write(KeyDoc kd,
> IntWritable v) throws IOException{
>
>
> And in this function when I'm accessing the KeyDoc attributes compiler
> is shooting the following error..
>
>
> KeyDocOutputFormat.java:55: cannot find symbol
> symbol : method get(java.lang.String)
> location: class java.lang.Object
> out.write(kd.get("docTitle"));
>
> Its considering the kd as an Object not as an KeyDoc... So for checking
> this I gave.....
>
> if(kd instanceof KeyDoc)
> out.write(kd.get("word"));
>
> then the error is ....
>
> KeyDocOutputFormat.java:50: unexpected type
> found : KeyDoc
> required: class or array
> if(kd instanceof KeyDoc)
>
> Can someone help me in debugging it .....
>
> --
> vJay
>
> PS :: I attached the source code..
>
>
>
>
--
vJay
RE: reg : my OutputFormat class cannot recognize my WritableComparable class
Posted by Jeyendran Balakrishnan <jb...@docomolabs-usa.com>.
Try replacing your class definitions to:
public class KeyDocOutputFormat implements
OutputFormat<KeyDoc,IntWritable>{
and
public static class MyRecordWriter implements RecordWriter<KeyDoc,
IntWritable>{
________________________________
From: Vijay Bharath Reddy [mailto:vijaybharathenator@gmail.com]
Sent: Thursday, September 17, 2009 11:17 AM
To: common-user@hadoop.apache.org
Subject: reg : my OutputFormat class cannot recognize my
WritableComparable class
Hi,
I'm writing my own OutputFormat class and I faced the folloeing errors.
-- public class KeyDoc implements WritableComparable{
this is my WritableComparable implementation...
-- public class KeyDocOutputFormat<KeyDoc,IntWritable> implements
OutputFormat<KeyDoc,IntWritable>{
this is my OutputFormat implementation...
In this KeyDocOutputFormat class I implemented RecordWriter ..
-- public static class MyRecordWriter<KeyDoc,
IntWritable> implements RecordWriter<KeyDoc, IntWritable>{
In this RecordWriter my write function goes like
this...
-- public synchronized void write(KeyDoc kd,
IntWritable v) throws IOException{
And in this function when I'm accessing the KeyDoc attributes compiler
is shooting the following error..
KeyDocOutputFormat.java:55: cannot find symbol
symbol : method get(java.lang.String)
location: class java.lang.Object
out.write(kd.get("docTitle"));
Its considering the kd as an Object not as an KeyDoc... So for checking
this I gave.....
if(kd instanceof KeyDoc)
out.write(kd.get("word"));
then the error is ....
KeyDocOutputFormat.java:50: unexpected type
found : KeyDoc
required: class or array
if(kd instanceof KeyDoc)
Can someone help me in debugging it .....
--
vJay
PS :: I attached the source code..