Tuesday, August 23, 2016

Hive vs PIG

Hive

PIG

Developed at Facebook

Developed at Yahoo!
          Hive is best for structured Data 
          
PIG is best for semi structured data
Hive used for reporting

PIG for programming
Hive used as a declarative SQL

PIG used as procedural language
Hive supports partitions

PIG does not
          Hive can start an optional thrift based server 
          
         PIG can't

          Hive defines tables before hand (schema) + stores schema information in database

PIG don't have dedicated metadata of database
          Hive does not support Avro

PIG does
Hive does not

Pig also supports additional COGROUP feature for performing outer joins.
Both Hive & PIG can join, order & sort dynamically

Friday, January 15, 2016

Singleton Class vs Static Class

Singleton Class

Static Class

·         They can be extended
·         Cannot
·         They can be passed around as an object
·         Cannot
·         They can Garbage collected
·         Cannot
·         They can override methods defined in Singleton class by extending it.
·         Cannot as it leads to inflexibility
·         Easy to create mock object for JUnits
·         Difficult to create mock objects and hard to test
·         They can be LAZY loaded if it’s a heavy object
·         Always early loaded
·          
·         Better performance as static methods  are bonded at compile time
·         Use when need full  OO capability i.e. inheritance and polymorphism
·         Use when need to store bunch of static methods together