Why we use IntWritable instead of Int? Why we use LongWritable instead of Long?

Free Online Certification Courses – Learn Today. Lead Tomorrow. Forums Apache Hadoop Why we use IntWritable instead of Int? Why we use LongWritable instead of Long?

Viewing 3 reply threads
  • Author
    Posts
    • #5585
      DataFlair TeamDataFlair Team
      Spectator

      Why Hadoop uses IntWritable instead of int ? Why Hadoop needs new data types ? What is difference between default java data types and corresponding Hadoop classes like int vs IntWritable, long vs LongWritable ?

    • #5586
      DataFlair TeamDataFlair Team
      Spectator

      IntLong are java datatypes, while IntWritableLongWritable are Hadoopdatatypes. We use these datatypes in MapReduce function.These are used to handle objects in hadoop way.The object is serialised into byte of stream and then deserialized later. Since hadoop processes huge amount of data,it needs special datatypes to handle these and provide easier abstraction.

    • #5587
      DataFlair TeamDataFlair Team
      Spectator

      Since data is processing over a network, in order the optimize the data, Hadoop has it’s own data types. For example, Hadoop uses Text but Java uses the String, due to some similarity. But in Hadoop, Text implements interfaces like Comparable, Writable and WritableComparable.

    • #5589
      DataFlair TeamDataFlair Team
      Spectator

      In Java, we have also Wrapper classes which are Serialized by default, and Hadoop datatypes are also Serialized but the main difference is that Java Serialized objects are too heavy which consume much network bandwidth while moving over the network. So Hadoop creates own data types to handle the network issues and Hadoop data types are much lighter than Java data types.

Viewing 3 reply threads
  • You must be logged in to reply to this topic.