Attaching my first try, pig-5300-v01.patch.
This change will update
which extends from DefaultAbstractBag and also
SingleTupleBag and NonSpillableDataBag which have their own implementation of DataBag.
NOT touching AccumulativeBag, LimitedSortedDataBag and ReadOnceBag in the belief that they will not be used in hashcode/equals/compareTo. At the same time, I didn't have the courage to throw Exceptions from them.
Also added hashcode method to DataBag interface just for documentation purposes. (Just like Map interface in Java.) Also added null check for "equals" calls since java api documents that they should return false (and not throw NPE).