public boolean hasNext() { if (this.emitNull) { return true; } return it.hasNext(); }
public boolean hasNext() { if (this.emitNull) { return true; } return it.hasNext(); }
public boolean hasNext() { return this.mapIterator.hasNext() || this.currentDup < this.dupLimit; }
public boolean hasNext() { return this.mapIterator.hasNext() || this.currentDup < this.dupLimit; }
public void toData(DataOutput out) throws IOException { DataSerializer.writeObject(this.elementType, out); out.writeInt(this.size()); this.writeNumNulls(out); // TODO:Asif: Should we actually pass the limit in serialization? // For the time being not passing , assuming PR Has parsed // it // out.writeInt(this.limit); int numLeft = this.size() - this.numNulls; for (TObjectIntIterator itr = this.map.iterator(); itr.hasNext() && numLeft > 0;) { itr.advance(); Object key = itr.key(); DataSerializer.writeObject(key, out); int occurence = itr.value(); if (numLeft < occurence) { occurence = numLeft; } out.writeInt(occurence); numLeft -= occurence; } }
public void toData(DataOutput out) throws IOException { DataSerializer.writeObject(this.elementType, out); out.writeInt(this.size()); this.writeNumNulls(out); // TODO:Asif: Should we actually pass the limit in serialization? // For the time being not passing , assuming PR Has parsed // it // out.writeInt(this.limit); int numLeft = this.size() - this.numNulls; for (TObjectIntIterator itr = this.map.iterator(); itr.hasNext() && numLeft > 0;) { itr.advance(); Object key = itr.key(); DataSerializer.writeObject(key, out); int occurence = itr.value(); if (numLeft < occurence) { occurence = numLeft; } out.writeInt(occurence); numLeft -= occurence; } }
/** Creates a StructSet directly from a StructBag; * (internal use) * @since 5.1 */ StructSet(StructBag bag) { super(new ObjectArrayHashingStrategy()); this.structType = (StructType)bag.elementType; if (bag.hasLimitIterator) { // Asif: Since the number of unique keys which // will be returned by Bag with limit in place // cannot be more than the size of the bag ( i.e // the limit) , we can safely assume HashMap size // to equal to bag's size ensureCapacity(bag.size()); Iterator itr = bag.fieldValuesIterator(); while (itr.hasNext()) { addFieldValues((Object[])itr.next()); } } else { TObjectIntIterator itr = bag.map.iterator(); ensureCapacity(bag.map.size()); while (itr.hasNext()) { itr.advance(); addFieldValues((Object[])itr.key()); } } }