pig-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Gates <ga...@yahoo-inc.com>
Subject compareTo functions for types
Date Wed, 31 Oct 2007 18:30:28 GMT
In reworking the types I noticed that the compareTo functions for each 
type are careful to provide an intertype sorting.  For example, from 

 public int compareTo(Object other) {
    if (other instanceof DataAtom) return +1;
    if (other instanceof Tuple) return -1;
    if (other instanceof DataBag){
        DataBag bOther = (DataBag) other;

Since a compareTo function is possibly called thousands of times during 
a single sort we really want these to be efficient. Is there a reason 
for all this cross type checking?  Do we have a need to sort Atoms in 
the same container with DataBags?


View raw message