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 4104210346 for ; Mon, 4 Nov 2013 08:55:27 +0000 (UTC) Received: (qmail 93904 invoked by uid 500); 4 Nov 2013 08:55:18 -0000 Delivered-To: apmail-hadoop-common-user-archive@hadoop.apache.org Received: (qmail 93666 invoked by uid 500); 4 Nov 2013 08:55:12 -0000 Mailing-List: contact user-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hadoop.apache.org Delivered-To: mailing list user@hadoop.apache.org Received: (qmail 93659 invoked by uid 99); 4 Nov 2013 08:55:11 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Nov 2013 08:55:11 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of unmeshabiju@gmail.com designates 209.85.220.175 as permitted sender) Received: from [209.85.220.175] (HELO mail-vc0-f175.google.com) (209.85.220.175) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Nov 2013 08:55:07 +0000 Received: by mail-vc0-f175.google.com with SMTP id ht10so4382196vcb.20 for ; Mon, 04 Nov 2013 00:54:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=/UCcI3y8szocXwC8PaRAg5xILZ0abz2MeV1gANCabG4=; b=OyIxUCa3RRKyE/vfQqgWeHNonzYg/yFgKvPrfWVJ+lEZQbwdzo4DdAVQLPWNqev2py r2UWSax2wPTJKxtNH0Ae66/Mg7Sgg6Vg8K1DmeQNjLpinvCatZbSA5UcVU/0L2OpUGTk 4ncGkGiigjX6t/Tl/87lQdMXmCqYiJmttWGEM/GfQiSMJgOV/iWY38ucS74d3dNLwVYy WF8L8uruz0O++crcOfGnA7Jsng4ea5Tbk3F3c0VBvoytHsTJ9RXu6q8mFbPFISzYfRmB J/q9aHbhxW5W/Oc11ocXNzBeUWp8pyW7O7nQSi0KURlhEc9AIfjBASSyPiQOlMo9cASr zJww== MIME-Version: 1.0 X-Received: by 10.221.27.73 with SMTP id rp9mr877551vcb.29.1383555286626; Mon, 04 Nov 2013 00:54:46 -0800 (PST) Received: by 10.59.8.2 with HTTP; Mon, 4 Nov 2013 00:54:46 -0800 (PST) In-Reply-To: References: Date: Mon, 4 Nov 2013 14:24:46 +0530 Message-ID: Subject: Re: Implementing a custom hadoop key and value - need Help From: unmesha sreeveni To: User Hadoop Content-Type: multipart/alternative; boundary=001a1133970662f5a604ea561122 X-Virus-Checked: Checked by ClamAV on apache.org --001a1133970662f5a604ea561122 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable yes .By editing some of my code..... i am able to get my emitted matrix VALUE in reducer :) :) :) :). context.write(......, new MatrixWritable(Eval)); But i am confused , HOW TO EMIT A KEY too from mapper ..what will be my CompareTo() method in my MatrixWritable class. can anyone suggest me. On Sun, Nov 3, 2013 at 11:33 PM, unmesha sreeveni wr= ote: > Thanks for ur reply..Mirko Kampf. And the suggestion was really good for > beginners. > > > The second one is right :) .*But you wrote also: I need to emit a 2D > double array as key and value from mapper.* > *Means, you work with a k-v-pair * > > *KVP* > > *There Matrix is 2-D matrix of double values.* > > > Yes i need to emit 2 matrices,1 key and the other is value. > > ie key -----> A*Atrans--------->after multiplication the result will be = a > 2D array which is declared as double (matrix) lets say the result be Matr= ix > "*Ekey*"(double[][] Ekey) > > value ------> Atrans*D ---------> after multiplication the result will b= e > Matrix "*Eval*" (double[][] Eval). > > After tat i need to emit these matrix to reducer for further calculations= . > > so in mapper > context.write(*Ekey*,*Eval*); > > reducer > i need to do further calculations with these Ekey nd Eval. > > > so i need to emit context.write(matrix,matrix).....for that i created > MatrixWritable class. > > 1.Is that the correct way or i can directly go for TwoDArrayWritable? > 2.In reducer i gave iterable why becoz my key and value are matrices.That > y i gave them as iterable. IS nt that right????? > If wrong how to give the reducer signature. > > > > > > > > > > > On Sun, Nov 3, 2013 at 5:44 PM, Mirko K=E4mpf wro= te: > >> public class MyReducer extends >> >> >> Reducer { >> >> public void reduce(*Iterable* key, >> Iterable values, Context context){ >> for(MatrixWritable c : values){ >> >> System.out.println("print value "+c.toString()); >> >> } >> >> } >> >> Usually a key is only one object, not an Iterable. >> >> To make things more clear: >> >> What is the exact k-v-pair you need in the Reducer? >> >> One matrix is the key, and a set of (two matrices together) are used as >> value in the Reducer? What I understood from your question is >> KVP >> >> >> *But you wrote also:* I need to emit a 2D double array as key and value >> from mapper. >> Means, you work with a k-v-pair >> >> KVP >> >> There Matrix is 2-D matrix of double values. >> >> I suggest: >> >> 1.) Define the MR Data Flow. >> 2.) Build the custom types. >> 3.) Test the flow (no computation) >> 4.) Implement logic / computation >> >> >> >> >> >> >> >> >> 2013/11/3 unmesha sreeveni >> >>> I tried with TwoDArrayWritable too. >>> >>> but i tried it by emitting only one value. >>> >>> row =3D E.length; >>> col =3D E[0].length; >>> TwoDArrayWritable array =3D new TwoDArrayWritable = (DoubleWritable.class); >>> DoubleWritable[][] myInnerArray =3D new DoubleWrit= able[row][col]; >>> // set values in myInnerArray >>> for (int k1 =3D 0; k1 < row; k1++) { >>> for(int j1=3D0;j1< col;j1++){ >>> myInnerArray[k1][j1] =3D new DoubleWritable= (E[k1][j1]); >>> >>> } >>> array.set(myInnerArray); >>> context.write(clusterNumber, array); >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> this is also not working for me >>> >>> showing NullPointerException >>> >>> 13/11/01 16:34:07 INFO mapred.LocalJobRunner: Map task executor complet= e. >>> 13/11/01 16:34:07 WARN mapred.LocalJobRunner: job_local724758890_0001 >>> java.lang.Exception: java.lang.NullPointerException >>> at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.j= ava:404) >>> Caused by: java.lang.NullPointerException >>> at org.apache.hadoop.io.TwoDArrayWritable.write(TwoDArrayWritable.j= ava:91) >>> at org.apache.hadoop.io.serializer.WritableSerialization$WritableSe= rializer.serialize(WritableSerialization.java:100) >>> at org.apache.hadoop.io.serializer.WritableSerialization$WritableSe= rializer.serialize(WritableSerialization.java:84) >>> at org.apache.hadoop.mapred.MapTask$MapOutputBuffer.collect(MapTask= .java:945) >>> at org.apache.hadoop.mapred.MapTask$NewOutputCollector.write(MapTas= k.java:601) >>> at org.apache.hadoop.mapreduce.task.TaskInputOutputContextImpl.writ= e(TaskInputOutputContextImpl.java:85) >>> at org.apache.hadoop.mapreduce.lib.map.WrappedMapper$Context.write(= WrappedMapper.java:106) >>> at edu.Mapper.map(Mapper.java:277) >>> >>> >>> Mapper.java:277 : context.write(clusterNumber, array); >>> >>> >>> >>> On Sun, Nov 3, 2013 at 5:07 PM, unmesha sreeveni wrote: >>> >>>> @Amr Shahin >>>> this is my post from stackoverflow >>>> but i am not getting any response. >>>> >>>> >>>> I need to emit a 2D double array as key and value from mapper.There ar= e >>>> questions posted in stackoverflow. But they are not answered. >>>> we have to create a custom datatype.but how?I am new to these custom >>>> datatypes. i dnt have any idea where to start.I am doing some of the m= atrix >>>> multiplication in a given dataset.and after that i need to emit the va= lue of >>>> A*Atrns which will be a matrix and Atrans*D which will also be a >>>> matrix.so how to emit these matrices from mapper.And the value should >>>> be corresponding to the key itself.I think for that we need to use >>>> WritableComparable. >>>> >>>> >>>> >>>> public class MatrixWritable implements WritableComparable{ >>>> >>>> /** >>>> * @param args >>>> */ >>>> private double[][] value; >>>> >>>> public MatrixWritable() { >>>> // TODO Auto-generated constructor stub >>>> set(new double[0][0]); >>>> } >>>> >>>> public MatrixWritable(double[][] value) { >>>> // TODO Auto-generated constructor stub >>>> this.value =3D value; >>>> } >>>> >>>> public void set(double[][] value) { >>>> this.value =3D value; >>>> } >>>> >>>> public double[][] getValue() { >>>> return value; >>>> } >>>> >>>> @Override >>>> public void write(DataOutput out) throws IOException { >>>> System.out.println("write"); >>>> int row=3D0; >>>> int col=3D0; >>>> for(int i=3D0; i>>> row =3D value.length; >>>> for(int j=3D0; j>>> col =3D value[i].length; >>>> } >>>> } >>>> out.writeInt(row); >>>> out.writeInt(col); >>>> >>>> System.out.println("\nTotal no of observations: "+row+":"+col)= ; >>>> >>>> for(int i=3D0;i>>> for(int j=3D 0 ; j< col;j++){ >>>> >>>> out.writeDouble(value[i][j]); >>>> } >>>> } >>>> //priting array >>>> for(int vali =3D0;vali< value.length ;vali ++){ >>>> for(int valj =3D 0;valj >>> System.out.print(value[vali][valj]+ "\t"); >>>> } >>>> System.out.println(""); >>>> } >>>> >>>> } >>>> >>>> @Override >>>> public void readFields(DataInput in) throws IOException { >>>> int row =3D in.readInt(); >>>> int col =3D in.readInt(); >>>> >>>> double[][] value =3D new double[row][col]; >>>> for(int i=3D0;i>>> for(int j=3D 0 ; j< col;j++){ >>>> value[i][j] =3D in.readDouble(); >>>> >>>> } >>>> } >>>> >>>> } >>>> >>>> @Override >>>> public int hashCode() { >>>> >>>> } >>>> >>>> @Override >>>> public boolean equals(Object o) { >>>> >>>> } >>>> >>>> >>>> @Override >>>> public int compareTo(MatrixWritable o) { >>>> // TODO Auto-generated method stub >>>> return 0; >>>> } >>>> @Override >>>> public String toString() { >>>> >>>> return Arrays.toString(value); >>>> >>>> } >>>> >>>> >>>> >>>> } >>>> >>>> I wrote matrix write,readfields and toString. >>>> >>>> 1.But my toString is not returning anything. why is it so? >>>> >>>> 2.How to print these values with in Reducer ?I tried doing(tried with = emiting only custom value- for checking) >>>> >>>> public class MyReducer extends >>>> >>>> >>>> Reducer { >>>> >>>> public void reduce(Iterable key, >>>> Iterable values, Context context){ >>>> for(MatrixWritable c : values){ >>>> >>>> System.out.println("print value "+c.toString()); >>>> >>>> } >>>> >>>> } >>>> >>>> but Nothing is printing.when i tried to print value[0].length in toStr= ing() >>>> method it showsArrayIndexOutOfBoundExcep.Am i doing any thing wrong.an= d >>>> i also needed to print my data asmatrix so i tried >>>> >>>> public String toString() { >>>> >>>> String separator =3D ", "; >>>> StringBuffer result =3D new StringBuffer(); >>>> >>>> // iterate over the first dimension >>>> for (int i =3D 0; i < value.length; i++) { >>>> // iterate over the second dimension >>>> for(int j =3D 0; j < value[i].length; j++){ >>>> result.append(value[i][j]); >>>> System.out.print(value[i][j]); >>>> result.append(separator); >>>> } >>>> // remove the last separator >>>> result.setLength(result.length() - separator.length()); >>>> // add a line break. >>>> result.append("\n"); >>>> } >>>> >>>> >>>> return result.toString(); >>>> >>>> >>>> } >>>> >>>> >>>> >>>> On Sun, Nov 3, 2013 at 5:04 PM, unmesha sreeveni >>> > wrote: >>>> >>>>> @Amr shahin >>>>> this is my post from stackoverflow >>>>> but i am not getting any response. >>>>> >>>>> >>>>> I need to emit a 2D double array as key and value from mapper.There >>>>> are questions posted in stackoverflow. But they are not answered. >>>>> we have to create a custom datatype.but how?I am new to these custom >>>>> datatypes. i dnt have any idea where to start.I am doing some of the = matrix >>>>> multiplication in a given dataset.and after that i need to emit the v= alue of >>>>> A*Atrns which will be a matrix and Atrans*D which will also be a >>>>> matrix.so how to emit these matrices from mapper.And the value should >>>>> be corresponding to the key itself.I think for that we need to use >>>>> WritableComparable. >>>>> >>>>> >>>>> >>>>> public class MatrixWritable implements WritableComparable{ >>>>> >>>>> /** >>>>> * @param args >>>>> */ >>>>> private double[][] value; >>>>> >>>>> public MatrixWritable() { >>>>> // TODO Auto-generated constructor stub >>>>> set(new double[0][0]); >>>>> } >>>>> >>>>> public MatrixWritable(double[][] value) { >>>>> // TODO Auto-generated constructor stub >>>>> this.value =3D value; >>>>> } >>>>> >>>>> public void set(double[][] value) { >>>>> this.value =3D value; >>>>> } >>>>> >>>>> public double[][] getValue() { >>>>> return value; >>>>> } >>>>> >>>>> @Override >>>>> public void write(DataOutput out) throws IOException { >>>>> System.out.println("write"); >>>>> int row=3D0; >>>>> int col=3D0; >>>>> for(int i=3D0; i>>>> row =3D value.length; >>>>> for(int j=3D0; j>>>> col =3D value[i].length; >>>>> } >>>>> } >>>>> out.writeInt(row); >>>>> out.writeInt(col); >>>>> >>>>> System.out.println("\nTotal no of observations: "+row+":"+col= ); >>>>> >>>>> for(int i=3D0;i>>>> for(int j=3D 0 ; j< col;j++){ >>>>> >>>>> out.writeDouble(value[i][j]); >>>>> } >>>>> } >>>>> //priting array >>>>> for(int vali =3D0;vali< value.length ;vali ++){ >>>>> for(int valj =3D 0;valj >>>> System.out.print(value[vali][valj]+ "\t"); >>>>> } >>>>> System.out.println(""); >>>>> } >>>>> >>>>> } >>>>> >>>>> @Override >>>>> public void readFields(DataInput in) throws IOException { >>>>> int row =3D in.readInt(); >>>>> int col =3D in.readInt(); >>>>> >>>>> double[][] value =3D new double[row][col]; >>>>> for(int i=3D0;i>>>> for(int j=3D 0 ; j< col;j++){ >>>>> value[i][j] =3D in.readDouble(); >>>>> >>>>> } >>>>> } >>>>> >>>>> } >>>>> >>>>> @Override >>>>> public int hashCode() { >>>>> >>>>> } >>>>> >>>>> @Override >>>>> public boolean equals(Object o) { >>>>> >>>>> } >>>>> >>>>> >>>>> @Override >>>>> public int compareTo(MatrixWritable o) { >>>>> // TODO Auto-generated method stub >>>>> return 0; >>>>> } >>>>> @Override >>>>> public String toString() { >>>>> >>>>> return Arrays.toString(value); >>>>> >>>>> } >>>>> >>>>> >>>>> >>>>> } >>>>> >>>>> I wrote matrix write,readfields and toString. >>>>> >>>>> 1.But my toString is not returning anything. why is it so? >>>>> >>>>> 2.How to print these values with in Reducer ?I tried doing(tried with= emiting only custom value- for checking) >>>>> >>>>> public class MyReducer extends >>>>> >>>>> >>>>> Reducer { >>>>> >>>>> public void reduce(Iterable key, >>>>> Iterable values, Context context){ >>>>> for(MatrixWritable c : values){ >>>>> >>>>> System.out.println("print value "+c.toString()); >>>>> >>>>> } >>>>> >>>>> } >>>>> >>>>> but Nothing is printing.when i tried to print value[0].length in toSt= ring() >>>>> method it showsArrayIndexOutOfBoundExcep.Am i doing any thing wrong.a= nd >>>>> i also needed to print my data asmatrix so i tried >>>>> >>>>> public String toString() { >>>>> >>>>> String separator =3D ", "; >>>>> StringBuffer result =3D new StringBuffer(); >>>>> >>>>> // iterate over the first dimension >>>>> for (int i =3D 0; i < value.length; i++) { >>>>> // iterate over the second dimension >>>>> for(int j =3D 0; j < value[i].length; j++){ >>>>> result.append(value[i][j]); >>>>> System.out.print(value[i][j]); >>>>> result.append(separator); >>>>> } >>>>> // remove the last separator >>>>> result.setLength(result.length() - separator.length()); >>>>> // add a line break. >>>>> result.append("\n"); >>>>> } >>>>> >>>>> >>>>> return result.toString(); >>>>> >>>>> >>>>> } >>>>> >>>>> >>>>> >>>>> On Sat, Nov 2, 2013 at 7:56 PM, Amr Shahin wrote= : >>>>> >>>>>> Can you share the code? >>>>>> >>>>>> sent from mobile >>>>>> On Nov 1, 2013 7:06 AM, "unmesha sreeveni" >>>>>> wrote: >>>>>> >>>>>>> >>>>>>> thanks Steve Loughran and Amr Shahin >>>>>>> Amr Shahin , i refered " >>>>>>> http://my.safaribooksonline.com/book/databases/hadoop/9780596521974= /serialization/id3548156" >>>>>>> the same thing only. but my toString is not returning anything. >>>>>>> >>>>>>> >>>>>>> >>>>>>> On Thu, Oct 31, 2013 at 5:57 PM, Amr Shahin wr= ote: >>>>>>> >>>>>>>> Check this out: >>>>>>>> >>>>>>>> http://developer.yahoo.com/hadoop/tutorial/module5.html#writable-n= otes >>>>>>>> It shows how to create a customer writable. If you have "hadoop t= he >>>>>>>> definitive guide" there is a really good explanation about custom >>>>>>>> data >>>>>>>> types. >>>>>>>> >>>>>>>> Happy Halloween >>>>>>>> >>>>>>>> >>>>>>>> On Thu, Oct 31, 2013 at 3:03 PM, unmesha sreeveni < >>>>>>>> unmeshabiju@gmail.com>wrote: >>>>>>>> >>>>>>>> > this is my post from stackoverflow >>>>>>>> > but i am not getting any response. >>>>>>>> > >>>>>>>> > >>>>>>>> > I need to emit a 2D double array as key and value from >>>>>>>> mapper.There are >>>>>>>> > questions posted in stackoverflow. But they are not answered. >>>>>>>> > we have to create a custom datatype.but how?I am new to these >>>>>>>> custom >>>>>>>> > datatypes. i dnt have any idea where to start.I am doing some of >>>>>>>> the matrix >>>>>>>> > multiplication in a given dataset.and after that i need to emit >>>>>>>> the value >>>>>>>> > of >>>>>>>> > A*Atrns which will be a matrix and Atrans*D which will also be = a >>>>>>>> matrix.so >>>>>>>> > how to emit these matrices from mapper.And the value should be >>>>>>>> > corresponding to the key itself.I think for that we need to use >>>>>>>> > WritableComparable. >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> > public class MatrixWritable implements >>>>>>>> WritableComparable{ >>>>>>>> > >>>>>>>> > /** >>>>>>>> > * @param args >>>>>>>> > */ >>>>>>>> > private double[][] value; >>>>>>>> > >>>>>>>> > public MatrixWritable() { >>>>>>>> > // TODO Auto-generated constructor stub >>>>>>>> > set(new double[0][0]); >>>>>>>> > } >>>>>>>> > >>>>>>>> > public MatrixWritable(double[][] value) { >>>>>>>> > // TODO Auto-generated constructor stub >>>>>>>> > this.value =3D value; >>>>>>>> > } >>>>>>>> > >>>>>>>> > public void set(double[][] value) { >>>>>>>> > this.value =3D value; >>>>>>>> > } >>>>>>>> > >>>>>>>> > public double[][] getValue() { >>>>>>>> > return value; >>>>>>>> > } >>>>>>>> > >>>>>>>> > @Override >>>>>>>> > public void write(DataOutput out) throws IOException { >>>>>>>> > System.out.println("write"); >>>>>>>> > int row=3D0; >>>>>>>> > int col=3D0; >>>>>>>> > for(int i=3D0; i>>>>>>> > row =3D value.length; >>>>>>>> > for(int j=3D0; j>>>>>>> > col =3D value[i].length; >>>>>>>> > } >>>>>>>> > } >>>>>>>> > out.writeInt(row); >>>>>>>> > out.writeInt(col); >>>>>>>> > >>>>>>>> > System.out.println("\nTotal no of observations: >>>>>>>> "+row+":"+col); >>>>>>>> > >>>>>>>> > for(int i=3D0;i>>>>>>> > for(int j=3D 0 ; j< col;j++){ >>>>>>>> > >>>>>>>> > out.writeDouble(value[i][j]); >>>>>>>> > } >>>>>>>> > } >>>>>>>> > //priting array >>>>>>>> > for(int vali =3D0;vali< value.length ;vali ++){ >>>>>>>> > for(int valj =3D 0;valj >>>>>>> > System.out.print(value[vali][valj]+ "\t"); >>>>>>>> > } >>>>>>>> > System.out.println(""); >>>>>>>> > } >>>>>>>> > >>>>>>>> > } >>>>>>>> > >>>>>>>> > @Override >>>>>>>> > public void readFields(DataInput in) throws IOException { >>>>>>>> > int row =3D in.readInt(); >>>>>>>> > int col =3D in.readInt(); >>>>>>>> > >>>>>>>> > double[][] value =3D new double[row][col]; >>>>>>>> > for(int i=3D0;i>>>>>>> > for(int j=3D 0 ; j< col;j++){ >>>>>>>> > value[i][j] =3D in.readDouble(); >>>>>>>> > >>>>>>>> > } >>>>>>>> > } >>>>>>>> > >>>>>>>> > } >>>>>>>> > >>>>>>>> > @Override >>>>>>>> > public int hashCode() { >>>>>>>> > >>>>>>>> > } >>>>>>>> > >>>>>>>> > @Override >>>>>>>> > public boolean equals(Object o) { >>>>>>>> > >>>>>>>> > } >>>>>>>> > >>>>>>>> > >>>>>>>> > @Override >>>>>>>> > public int compareTo(MatrixWritable o) { >>>>>>>> > // TODO Auto-generated method stub >>>>>>>> > return 0; >>>>>>>> > } >>>>>>>> > @Override >>>>>>>> > public String toString() { >>>>>>>> > >>>>>>>> > return Arrays.toString(value); >>>>>>>> > >>>>>>>> > } >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> > } >>>>>>>> > >>>>>>>> > I wrote matrix write,readfields and toString. >>>>>>>> > >>>>>>>> > 1.But my toString is not returning anything. why is it so? >>>>>>>> > >>>>>>>> > 2.How to print these values with in Reducer ?I tried doing(tried >>>>>>>> with >>>>>>>> > emiting only custom value- for checking) >>>>>>>> > >>>>>>>> > public class MyReducer extends >>>>>>>> > >>>>>>>> > >>>>>>>> > Reducer { >>>>>>>> > >>>>>>>> > public void reduce(Iterable key, >>>>>>>> > Iterable values, Context context){ >>>>>>>> > for(MatrixWritable c : values){ >>>>>>>> > >>>>>>>> > System.out.println("print value "+c.toString()); >>>>>>>> > >>>>>>>> > } >>>>>>>> > >>>>>>>> > } >>>>>>>> > >>>>>>>> > but Nothing is printing.when i tried to print value[0].length in >>>>>>>> toString() >>>>>>>> > method it showsArrayIndexOutOfBoundExcep.Am i doing any thing >>>>>>>> wrong.and i >>>>>>>> > also needed to print my data asmatrix so i tried >>>>>>>> > >>>>>>>> > public String toString() { >>>>>>>> > >>>>>>>> > String separator =3D ", "; >>>>>>>> > StringBuffer result =3D new StringBuffer(); >>>>>>>> > >>>>>>>> > // iterate over the first dimension >>>>>>>> > for (int i =3D 0; i < value.length; i++) { >>>>>>>> > // iterate over the second dimension >>>>>>>> > for(int j =3D 0; j < value[i].length; j++){ >>>>>>>> > result.append(value[i][j]); >>>>>>>> > System.out.print(value[i][j]); >>>>>>>> > result.append(separator); >>>>>>>> > } >>>>>>>> > // remove the last separator >>>>>>>> > result.setLength(result.length() - >>>>>>>> separator.length()); >>>>>>>> > // add a line break. >>>>>>>> > result.append("\n"); >>>>>>>> > } >>>>>>>> > >>>>>>>> > >>>>>>>> > return result.toString(); >>>>>>>> > >>>>>>>> > >>>>>>>> > } >>>>>>>> > >>>>>>>> > Again my output is empty. 3.Inorder to emit a key too as custom >>>>>>>> datatype >>>>>>>> > CompareTo is neccessary right . >>>>>>>> > >>>>>>>> > 4.so what should i include in that methods >>>>>>>> CompareTo,hashcode,equals and >>>>>>>> > what are these methods intended for. >>>>>>>> > Any Idea.Pls suggest a solution. >>>>>>>> > >>>>>>>> > -- >>>>>>>> > *Thanks & Regards* >>>>>>>> > * >>>>>>>> > * >>>>>>>> > Unmesha Sreeveni U.B* >>>>>>>> > * >>>>>>>> > *Junior Developer >>>>>>>> > * >>>>>>>> > *Amrita Center For Cyber Security >>>>>>>> > * >>>>>>>> > * >>>>>>>> > Amritapuri. >>>>>>>> > >>>>>>>> > www.amrita.edu/cyber/ >>>>>>>> > * >>>>>>>> > >>>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> *Thanks & Regards* >>>>>>> >>>>>>> Unmesha Sreeveni U.B >>>>>>> >>>>>>> *Junior Developer* >>>>>>> >>>>>>> *Amrita Center For Cyber Security * >>>>>>> >>>>>>> >>>>>>> * Amritapuri.www.amrita.edu/cyber/ * >>>>>>> >>>>>> >>>>> >>>>> >>>>> -- >>>>> *Thanks & Regards* >>>>> >>>>> Unmesha Sreeveni U.B >>>>> >>>>> *Junior Developer* >>>>> >>>>> *Amrita Center For Cyber Security * >>>>> >>>>> >>>>> * Amritapuri.www.amrita.edu/cyber/ * >>>>> >>>> >>>> >>>> >>>> -- >>>> *Thanks & Regards* >>>> >>>> Unmesha Sreeveni U.B >>>> >>>> *Junior Developer* >>>> >>>> *Amrita Center For Cyber Security * >>>> >>>> >>>> * Amritapuri.www.amrita.edu/cyber/ * >>>> >>> >>> >>> >>> -- >>> *Thanks & Regards* >>> >>> Unmesha Sreeveni U.B >>> >>> *Junior Developer* >>> >>> *Amrita Center For Cyber Security * >>> >>> >>> * Amritapuri.www.amrita.edu/cyber/ * >>> >> >> > > > -- > *Thanks & Regards* > > Unmesha Sreeveni U.B > > *Junior Developer* > > *Amrita Center For Cyber Security * > > > * Amritapuri.www.amrita.edu/cyber/ * > --=20 *Thanks & Regards* Unmesha Sreeveni U.B *Junior Developer* *Amrita Center For Cyber Security* * Amritapuri.www.amrita.edu/cyber/ * --001a1133970662f5a604ea561122 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
yes .By editing some of my code..... i am able to get my emitte= d matrix VALUE in reducer :) :) :) :).
context.write(......, new MatrixWritable(Eval));

But i am confus= ed , HOW TO EMIT A KEY too from mapper ..what will be my CompareTo() method in my MatrixWritabl= e class.
can a= nyone suggest me.


On Sun, Nov 3, 2013 at 11:33 PM, unmesha sreeveni <un= meshabiju@gmail.com> wrote:
Thanks for ur reply..Mirko Kampf= . And the suggestion was really good for beginners.


The second one is right :) .But you wrote also:=A0= I need to emit a 2D double array as key and value from mapper.
Means, you work with a k-v-pair=A0

KVP<Matrix,Matrix>

There Matrix is 2-D matrix of double values.

Yes i need to emit 2 matrices,1 key and the other is value.

ie= key -----> =A0A*Atrans--------->after multiplication the result will= be a 2D array which is declared as double (matrix) lets say the result be = Matrix "Ekey"(double[][] Ekey)

va= lue ------> =A0Atrans*D ---------> after multiplication the result wi= ll be Matrix "Eval" (double[][] Eval).

Af= ter tat i need to emit these matrix to reducer for further calculations.

so= in mapper=A0
=A0 =A0 =A0 =A0context= .write(Ekey,Eval);

reducer
=A0 =A0 =A0 i need to = do further calculations with these Ekey nd Eval.

so= i need to emit context.write(matrix,matrix).....for that i created MatrixW= ritable =A0class.

1.= Is that the correct way or i can directly go for TwoDArrayWritable?<= /font>
2= .In reducer i gave iterable why becoz my key and value are matrices.That y = i gave them as iterable. IS nt that right?????
I= f wrong how to give the reducer signature.
<= br>



On Sun, Nov 3, 2= 013 at 5:44 PM, Mirko K=E4mpf <mirko.kaempf@gmail.com> = wrote:
public class MyReducer extends


Reducer<MatrixWritable, MatrixWritable, IntWritable, Text> {

    public void reduce(Iterable<MatrixWritable>  key,
            Iterable<MatrixWritable> values, Context context){
              for(MatrixWritable c : values){

                System.out.println("print value "+c.toString());

            }=A0
}

Usually a key is only one object, not an Iterable.<= /span>

To make things more clear:

What is the exact k-v-pair you need in the = Reducer?

One matrix is the key, and a set of (two ma= trices together) are used as value in the Reducer?=A0<= font face=3D"Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, Deja= Vu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif">What I understood from your que= stion is=A0KVP<Matrix,Matrix[2]>


But you wrote also: I need to emit a 2D double array as key a= nd value from mapper.
Means, you work with a k-v-pair=A0

KVP<Matrix,Matrix>

There Matrix is 2-D matrix of double values= .

I suggest:

1.) Define the MR Data Flow.<= /span>
2.) Build the custom types.
3.) Test the flow (no computation)
4.) Implement logic / computation







2013/11/3 unmesha sreeveni <unmeshabi= ju@gmail.com>
I tried with=A0TwoDArrayWritable too.=A0

but i tried it by emittin= g only one value.

row =3D E.length;
col =3D E[0].length;
                     TwoDArrayWritable array =3D new TwoDArrayWritable (Dou=
bleWritable.class);
                     DoubleWritable[][] myInnerArray =3D new DoubleWritable=
[row][col];
                     // set values in myInnerArray
                     for (int k1 =3D 0; k1 < row; k1++) {
                        for(int j1=3D0;j1< col;j1++){
                            myInnerArray[k1][j1] =3D new DoubleWritable(E[k=
1][j1]);

                    }
                 array.set(myInnerArray);
                 context.write(clusterNumber, array);





this is also not working for me





showing NullPointerException


13/11/01 16:34:07 INFO mapred.LocalJobRun=
ner: Map task executor complete.
13/11/01 16:34:07 WARN mapred.LocalJobRunner: job_local724758890_0001
java.lang.Exception: java.lang.NullPointerException
    at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:=
404)
Caused by: java.lang.NullPointerException
    at org.apache.hadoop.io.TwoDArrayWritable.write(TwoDArrayWritable.java:=
91)
    at org.apache.hadoop.io.serializer.WritableSerialization$WritableSerial=
izer.serialize(WritableSerialization.java:100)
    at org.apache.hadoop.io.serializer.WritableSerialization$WritableSerial=
izer.serialize(WritableSerialization.java:84)
    at org.apache.hadoop.mapred.MapTask$MapOutputBuffer.collect(MapTask.jav=
a:945)
    at org.apache.hadoop.mapred.MapTask$NewOutputCollector.write(MapTask.ja=
va:601)
    at org.apache.hadoop.mapreduce.task.TaskInputOutputContextImpl.write(Ta=
skInputOutputContextImpl.java:85)
    at org.apache.hadoop.mapreduce.lib.map.WrappedMapper$Context.write(Wrap=
pedMapper.java:106)
    at edu.Mapper.map(Mapper.java:277)


Mapper.java:277 : context.write(clusterNumber, array);
<= /pre>


On Sun, Nov 3, 2013 at 5:07 PM, unmesha sreeveni <unmesh= abiju@gmail.com> wrote:
@Amr Shahin
this= is my post from stackoverflow
but i am not getting = any response.

I need to emit a 2D double arr= ay as key and value from mapper.There are questions posted in stackoverflow= . But they are not answered.
we have to create a=A0custom= =A0datatype.but ho= w?I am new to these custom datatypes. i dnt have any idea where to start.I = am doing some of the matrix multiplication in a given dataset.and after tha= t i need to emit the value of=A0A*Atrns=A0which will be a matrix and=A0Atra= ns*D=A0which will also be a matrix.s= o how to=A0= emit=A0= these=A0matrices=A0from=A0mapper.And the value should be corresponding to the key itself.I th= ink for that we need to use=A0WritableComparable.

<= /div>
=


public class MatrixWritable implements Wr=
itableComparable<MatrixWritable>{

/**
 * @param args
 */
private double[][] value;

public MatrixWritable() {
    // TODO Auto-generated constructor stub
      set(new double[0][0]);
}

public MatrixWritable(double[][] value) {
    // TODO Auto-generated constructor stub
      this.value =3D value;
}

public void set(double[][] value) {
      this.value =3D value;
 }

public double[][] getValue() {
        return value;
 }

 @Override
  public void write(DataOutput out) throws IOException {
     System.out.println("write");
     int row=3D0;
      int col=3D0;
        for(int i=3D0; i<value.length;i++){
            row =3D value.length;
            for(int j=3D0; j<value[i].length; j++){
                col =3D value[i].length;
            }
        }
        out.writeInt(row);
        out.writeInt(col);

        System.out.println("\nTotal no of observations: "+row+&qu=
ot;:"+col);

        for(int i=3D0;i<row ; i++){
            for(int j=3D 0 ; j< col;j++){

                 out.writeDouble(value[i][j]);
            }
        }
        //priting array
        for(int vali =3D0;vali< value.length ;vali ++){
            for(int valj =3D 0;valj <value[0].length;valj++){
                System.out.print(value[vali][valj]+ "\t");
            }
            System.out.println("");
        }

  }

  @Override
  public void readFields(DataInput in) throws IOException {
      int row =3D in.readInt();
      int col =3D in.readInt();

      double[][] value =3D new double[row][col];
      for(int i=3D0;i<row ; i++){
            for(int j=3D 0 ; j< col;j++){
                value[i][j] =3D in.readDouble();

            }
        }

  }

  @Override
  public int hashCode() {

  }

  @Override
  public boolean equals(Object o) {

  }


@Override
public int compareTo(MatrixWritable o) {
    // TODO Auto-generated method stub
    return 0;
}
 @Override
  public String toString() {

    return Arrays.toString(value);

  }

=A0
}

<= /div>
=

I wrote matrix write,readfields and toString.


1.But my toString is not returning anythi=
ng. why is it so?

2.How to print these values with in=A0=
Reducer=A0?I tr=
ied doing(tried with=A0emiting=A0only=A0custom value- for checking)
public class MyReducer extends


Reducer<MatrixWritable, MatrixWritable, IntWritable, Text> {

    public void reduce(Iterable<MatrixWritable>  key,
            Iterable<MatrixWritable> values, Context context){
              for(MatrixWritable c : values){

                System.out.println("print value "+c.toString());

            }=A0
}<= /div>

but Nothing is printing.wh= en i tried to print=A0value[0].length=A0in=A0toString() method=A0it= showsArrayIndexOutOfBoundExcep.Am i doing any thing=A0wrong.and i = also needed to print my data asmatrix=A0so i tried


    public String toString() {

     String separator =3D ", ";
        StringBuffer result =3D new StringBuffer();

        // iterate over the first dimension
        for (int i =3D 0; i < value.length; i++) {
            // iterate over the second dimension
            for(int j =3D 0; j < value[i].length; j++){
                result.append(value[i][j]);
                System.out.print(value[i][j]);
                result.append(separator);
            }
            // remove the last separator
            result.setLength(result.length() - separator.length());
            // add a line break.
            result.append("\n");
        }


        return result.toString();


  }


On Sun, Nov 3, 2013 at 5:04 PM, = unmesha sreeveni <unmeshabiju@gmail.com> wrote:
@Amr shahin
this is my post from stack= overflow
but i am not getting = any response.

I need to emit a 2D double arr= ay as key and value from mapper.There are questions posted in stackoverflow= . But they are not answered.
we have to create a=A0custom= =A0datatype.but ho= w?I am new to these custom datatypes. i dnt have any idea where to start.I = am doing some of the matrix multiplication in a given dataset.and after tha= t i need to emit the value of=A0A*Atrns=A0which will be a matrix and=A0Atra= ns*D=A0which will also be a matrix.s= o how to=A0= emit=A0= these=A0matrices=A0from=A0mapper.And the value should be corresponding to the key itself.I th= ink for that we need to use=A0WritableComparable.

<= /div>
=


public class MatrixWritable implements Wr=
itableComparable<MatrixWritable>{

/**
 * @param args
 */
private double[][] value;

public MatrixWritable() {
    // TODO Auto-generated constructor stub
      set(new double[0][0]);
}

public MatrixWritable(double[][] value) {
    // TODO Auto-generated constructor stub
      this.value =3D value;
}

public void set(double[][] value) {
      this.value =3D value;
 }

public double[][] getValue() {
        return value;
 }

 @Override
  public void write(DataOutput out) throws IOException {
     System.out.println("write");
     int row=3D0;
      int col=3D0;
        for(int i=3D0; i<value.length;i++){
            row =3D value.length;
            for(int j=3D0; j<value[i].length; j++){
                col =3D value[i].length;
            }
        }
        out.writeInt(row);
        out.writeInt(col);

        System.out.println("\nTotal no of observations: "+row+&qu=
ot;:"+col);

        for(int i=3D0;i<row ; i++){
            for(int j=3D 0 ; j< col;j++){

                 out.writeDouble(value[i][j]);
            }
        }
        //priting array
        for(int vali =3D0;vali< value.length ;vali ++){
            for(int valj =3D 0;valj <value[0].length;valj++){
                System.out.print(value[vali][valj]+ "\t");
            }
            System.out.println("");
        }

  }

  @Override
  public void readFields(DataInput in) throws IOException {
      int row =3D in.readInt();
      int col =3D in.readInt();

      double[][] value =3D new double[row][col];
      for(int i=3D0;i<row ; i++){
            for(int j=3D 0 ; j< col;j++){
                value[i][j] =3D in.readDouble();

            }
        }

  }

  @Override
  public int hashCode() {

  }

  @Override
  public boolean equals(Object o) {

  }


@Override
public int compareTo(MatrixWritable o) {
    // TODO Auto-generated method stub
    return 0;
}
 @Override
  public String toString() {

    return Arrays.toString(value);

  }

=A0
}

<= /div>
=

I wrote matrix write,readfields and toString.


1.But my toString is not returning anythi=
ng. why is it so?

2.How to print these values with in=A0=
Reducer=A0?I tr=
ied doing(tried with=A0emiting=A0only=A0custom value- for checking)
public class MyReducer extends


Reducer<MatrixWritable, MatrixWritable, IntWritable, Text> {

    public void reduce(Iterable<MatrixWritable>  key,
            Iterable<MatrixWritable> values, Context context){
              for(MatrixWritable c : values){

                System.out.println("print value "+c.toString());

            }=A0
}<= /div>

but Nothing is printing.wh= en i tried to print=A0value[0].length=A0in=A0toString() method=A0it= showsArrayIndexOutOfBoundExcep.Am i doing any thing=A0wrong.and i = also needed to print my data asmatrix=A0so i tried


    public String toString() {

     String separator =3D ", ";
        StringBuffer result =3D new StringBuffer();

        // iterate over the first dimension
        for (int i =3D 0; i < value.length; i++) {
            // iterate over the second dimension
            for(int j =3D 0; j < value[i].length; j++){
                result.append(value[i][j]);
                System.out.print(value[i][j]);
                result.append(separator);
            }
            // remove the last separator
            result.setLength(result.length() - separator.length());
            // add a line break.
            result.append("\n");
        }


        return result.toString();


  }


On Sat, Nov 2, 2013 at 7:56 PM, = Amr Shahin <amrnablus@gmail.com> wrote:

Can you share the code?

sent from mobile

On Nov 1, 2013 7:06 AM, "unmesha sreeveni&q= uot; <unmesha= biju@gmail.com> wrote:

thanks=A0Steve Loughran and=A0Amr Shahin
Amr Shahin , i refered "http://my.safaribookson= line.com/book/databases/hadoop/9780596521974/serialization/id3548156" the same thing only. but my toString is not return= ing anything.



On Thu,= Oct 31, 2013 at 5:57 PM, Amr Shahin <amrnablus@gmail.com>= wrote:
Check this out:
http://developer.yahoo.com/hadoop/tutorial/module= 5.html#writable-notes
It shows how to create a customer writable. If =A0you have "hadoop the=
definitive guide" there is a really good explanation about custom data=
types.

Happy Halloween


On Thu, Oct 31, 2013 at 3:03 PM, unmesha sreeveni <unmeshabiju@gmail.com>wrote:

> this is my post from stackoverflow
> but i am not getting any response.
>
>
> I need to emit a 2D double array as key and value from mapper.There ar= e
> questions posted in stackoverflow. But they are not answered.
> we have to create a custom datatype.but how?I am new to these custom > datatypes. i dnt have any idea where to start.I am doing some of the m= atrix
> multiplication in a given dataset.and after that i need to emit the va= lue
> of
> =A0A*Atrns which will be a matrix and Atrans*D which will also be a ma= trix.so
> how to emit these matrices from mapper.And the value should be
> corresponding to the key itself.I think for that we need to use
> WritableComparable.
>
>
>
> public class MatrixWritable implements WritableComparable<MatrixWri= table>{
>
> /**
> =A0* @param args
> =A0*/
> private double[][] value;
>
> public MatrixWritable() {
> =A0 =A0 // TODO Auto-generated constructor stub
> =A0 =A0 =A0 set(new double[0][0]);
> }
>
> public MatrixWritable(double[][] value) {
> =A0 =A0 // TODO Auto-generated constructor stub
> =A0 =A0 =A0 this.value =3D value;
> }
>
> public void set(double[][] value) {
> =A0 =A0 =A0 this.value =3D value;
> =A0}
>
> public double[][] getValue() {
> =A0 =A0 =A0 =A0 return value;
> =A0}
>
> =A0@Override
> =A0 public void write(DataOutput out) throws IOException {
> =A0 =A0 =A0System.out.println("write");
> =A0 =A0 =A0int row=3D0;
> =A0 =A0 =A0 int col=3D0;
> =A0 =A0 =A0 =A0 for(int i=3D0; i<value.length;i++){
> =A0 =A0 =A0 =A0 =A0 =A0 row =3D value.length;
> =A0 =A0 =A0 =A0 =A0 =A0 for(int j=3D0; j<value[i].length; j++){
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 col =3D value[i].length;
> =A0 =A0 =A0 =A0 =A0 =A0 }
> =A0 =A0 =A0 =A0 }
> =A0 =A0 =A0 =A0 out.writeInt(row);
> =A0 =A0 =A0 =A0 out.writeInt(col);
>
> =A0 =A0 =A0 =A0 System.out.println("\nTotal no of observations: &= quot;+row+":"+col);
>
> =A0 =A0 =A0 =A0 for(int i=3D0;i<row ; i++){
> =A0 =A0 =A0 =A0 =A0 =A0 for(int j=3D 0 ; j< col;j++){
>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0out.writeDouble(value[i][j]);
> =A0 =A0 =A0 =A0 =A0 =A0 }
> =A0 =A0 =A0 =A0 }
> =A0 =A0 =A0 =A0 //priting array
> =A0 =A0 =A0 =A0 for(int vali =3D0;vali< value.length ;vali ++){
> =A0 =A0 =A0 =A0 =A0 =A0 for(int valj =3D 0;valj <value[0].length;va= lj++){
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 System.out.print(value[vali][valj]+ &q= uot;\t");
> =A0 =A0 =A0 =A0 =A0 =A0 }
> =A0 =A0 =A0 =A0 =A0 =A0 System.out.println("");
> =A0 =A0 =A0 =A0 }
>
> =A0 }
>
> =A0 @Override
> =A0 public void readFields(DataInput in) throws IOException {
> =A0 =A0 =A0 int row =3D in.readInt();
> =A0 =A0 =A0 int col =3D in.readInt();
>
> =A0 =A0 =A0 double[][] value =3D new double[row][col];
> =A0 =A0 =A0 for(int i=3D0;i<row ; i++){
> =A0 =A0 =A0 =A0 =A0 =A0 for(int j=3D 0 ; j< col;j++){
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 value[i][j] =3D in.readDouble();
>
> =A0 =A0 =A0 =A0 =A0 =A0 }
> =A0 =A0 =A0 =A0 }
>
> =A0 }
>
> =A0 @Override
> =A0 public int hashCode() {
>
> =A0 }
>
> =A0 @Override
> =A0 public boolean equals(Object o) {
>
> =A0 }
>
>
> @Override
> public int compareTo(MatrixWritable o) {
> =A0 =A0 // TODO Auto-generated method stub
> =A0 =A0 return 0;
> }
> =A0@Override
> =A0 public String toString() {
>
> =A0 =A0 return Arrays.toString(value);
>
> =A0 }
>
>
>
> }
>
> I wrote matrix write,readfields and toString.
>
> 1.But my toString is not returning anything. why is it so?
>
> 2.How to print these values with in Reducer ?I tried doing(tried with<= br> > emiting only custom value- for checking)
>
> public class MyReducer extends
>
>
> Reducer<MatrixWritable, MatrixWritable, IntWritable, Text> {
>
> =A0 =A0 public void reduce(Iterable<MatrixWritable> =A0key,
> =A0 =A0 =A0 =A0 =A0 =A0 Iterable<MatrixWritable> values, Context= context){
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 for(MatrixWritable c : values){
>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 System.out.println("print value &= quot;+c.toString());
>
> =A0 =A0 =A0 =A0 =A0 =A0 }
>
> }
>
> but Nothing is printing.when i tried to print value[0].length in toStr= ing()
> method it showsArrayIndexOutOfBoundExcep.Am i doing any thing wrong.an= d i
> also needed to print my data asmatrix so i tried
>
> =A0 =A0 public String toString() {
>
> =A0 =A0 =A0String separator =3D ", ";
> =A0 =A0 =A0 =A0 StringBuffer result =3D new StringBuffer();
>
> =A0 =A0 =A0 =A0 // iterate over the first dimension
> =A0 =A0 =A0 =A0 for (int i =3D 0; i < value.length; i++) {
> =A0 =A0 =A0 =A0 =A0 =A0 // iterate over the second dimension
> =A0 =A0 =A0 =A0 =A0 =A0 for(int j =3D 0; j < value[i].length; j++){=
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 result.append(value[i][j]);
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 System.out.print(value[i][j]);
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 result.append(separator);
> =A0 =A0 =A0 =A0 =A0 =A0 }
> =A0 =A0 =A0 =A0 =A0 =A0 // remove the last separator
> =A0 =A0 =A0 =A0 =A0 =A0 result.setLength(result.length() - separator.l= ength());
> =A0 =A0 =A0 =A0 =A0 =A0 // add a line break.
> =A0 =A0 =A0 =A0 =A0 =A0 result.append("\n");
> =A0 =A0 =A0 =A0 }
>
>
> =A0 =A0 =A0 =A0 return result.toString();
>
>
> =A0 }
>
> Again my output is empty. 3.Inorder to emit a key too as custom dataty= pe
> CompareTo is neccessary right .
>
> 4.so what should i include in that methods CompareTo,hashcode,equals a= nd
> what are these methods intended for.
> Any Idea.Pls suggest a solution.
>
> --
> *Thanks & Regards*
> *
> *
> Unmesha Sreeveni U.B*
> *
> *Junior Developer
> *
> *Amrita Center For Cyber Security
> *
> *
> Amritapuri.
>
> www.amrita.= edu/cyber/
> *
>



--
Thanks & Regards

Unmesha Sreeveni U.B
Junior Developer
Amrita Center For Cyber Security



--
=
Thanks & Regards

Unmesha Sreeveni U.B
Junior Developer
Amrita Center For Cyber Security



--
=
Thanks & Regards

Unmesha Sreeveni U.B
Junior Developer
Amrita Center For Cyber Security



--
=
Thanks & Regards

Unmesha Sreeveni U.B
Junior Developer
Amrita Center For Cyber Security




--
=
Thanks & Regards

Unmesha Sreeveni U.B
Junior Developer
Amrita Center For Cyber Security



--
=
Thanks & Regards

Unmesha Sreeveni U.B
Junior Developer
Amrita Center For Cyber Security
--001a1133970662f5a604ea561122--