@Override
    public boolean equals(Object obj) {
      if (this == obj) return true;
      if (obj == null || obj.getClass() != this.getClass()) { return false; }

      ObjectInspectorObject comparedObject = (ObjectInspectorObject)obj;
      return ObjectInspectorUtils.compare(objects, oi, comparedObject.objects, comparedObject.oi) == 0;
    }
This class can be used to wrap Hive objects and put in HashMap or HashSet.
The objects will be compared using ObjectInspectors.
serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorUtils.java