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 zanurag <za...@live.com> on 2011/12/10 22:58:48 UTC
Re: ArrayWritable usage
Hi Dhruv,
Is this working well for you ?? Are you able to do IntWritable [] abc =
array.get();
I am trying similar thing for IntTwoDArrayWritable.
The array.set works but array.get returns Writable[][] and I am not able
to cast it to IntWritable[][].
--
View this message in context: http://lucene.472066.n3.nabble.com/ArrayWritable-usage-tp3138520p3576386.html
Sent from the Hadoop lucene-users mailing list archive at Nabble.com.
Re: ArrayWritable usage
Posted by Brock Noland <br...@cloudera.com>.
Hi,
ArrayWritable is a touch hard to use. Say you have an array of
IntWritable[]. The get() method or ArrayWritable, after
serializations/deserialization, does in fact return an array of type
Writable. As such you cannot cast it directly to IntWritable[]. Individual
elements are of type IntWritable and can be cast as such.
Will not work:
IntWritable[] array = (IntWritable[]) writable.get();
Will work:
for(Writable element : writable.get()) {
IntWritable intWritable = (IntWritable)element;
}
Brock
On Sat, Dec 10, 2011 at 3:58 PM, zanurag <za...@live.com> wrote:
> Hi Dhruv,
> Is this working well for you ?? Are you able to do IntWritable [] abc =
> array.get();
>
> I am trying similar thing for IntTwoDArrayWritable.
> The array.set works but array.get returns Writable[][] and I am not able
> to cast it to IntWritable[][].
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/ArrayWritable-usage-tp3138520p3576386.html
> Sent from the Hadoop lucene-users mailing list archive at Nabble.com.
>