Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Hadoop >> mail # user >> ArrayWritable usage

Copy link to this message
Re: ArrayWritable usage

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;


On Sat, Dec 10, 2011 at 3:58 PM, zanurag <[EMAIL PROTECTED]> 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.