| 122 | } |
| 123 | |
| 124 | @Override |
| 125 | public Tuple exec(Tuple input) throws IOException { |
| 126 | if (input == null || input.size() == 0) return null; |
| 127 | |
| 128 | // Strip off the initial level of bag |
| 129 | DataBag values = (DataBag)input.get(0); |
| 130 | Iterator<Tuple> it = values.iterator(); |
| 131 | Tuple t = it.next(); |
| 132 | |
| 133 | // If the input tuple has only one field, then we'll extract |
| 134 | // that field and serialize it into a key. If it has multiple |
| 135 | // fields, we'll serialize the whole tuple. |
| 136 | byte[] b; |
| 137 | if (t.size() == 1) b = DataType.toBytes(t.get(0)); |
| 138 | else b = DataType.toBytes(t, DataType.TUPLE); |
| 139 | |
| 140 | Key k = new Key(b); |
| 141 | filter = new BloomFilter(vSize, numHash, hType); |
| 142 | filter.add(k); |
| 143 | |
| 144 | return TupleFactory.getInstance().newTuple(bloomOut()); |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | static public class Intermediate extends BuildBloomBase<Tuple> { |