@Override public ITuple next() { if (!hasNext()) { throw new IllegalStateException("No more Tuple in the SingleRegionTupleIterator"); } IIProtos.IIResponse.IIRow currentRow = rows.get(index); byte[] columnsBytes = currentRow.getColumns().toByteArray(); this.tableRecord.setBytes(columnsBytes, 0, columnsBytes.length); if (currentRow.hasMeasures()) { byte[] measuresBytes = currentRow.getMeasures().toByteArray(); this.measureValues = pushedDownAggregators.deserializeMetricValues(measuresBytes, 0); } index++; return makeTuple(this.tableRecord, this.measureValues); }
@Override public int getPartition(LongWritable key, ImmutableBytesWritable value, int numPartitions) { rec.setBytes(value.get(), value.getOffset(), value.getLength()); return rec.getShard(); }
@Override public void reduce(LongWritable key, Iterable<ImmutableBytesWritable> values, Context context) // throws IOException, InterruptedException { for (ImmutableBytesWritable v : values) { rec.setBytes(v.get(), v.getOffset(), v.getLength()); if (builder == null) { builder = new SliceBuilder(info, rec.getShard()); } //TODO: to delete this log System.out.println(rec.getShard() + " - " + rec); Slice slice = builder.append(rec); if (slice != null) { output(slice, context); } } }
@Override public int getPartition(LongWritable key, ImmutableBytesWritable value, int numPartitions) { rec.setBytes(value.get(), value.getOffset(), value.getLength()); return rec.getShard(); }
@Override public void reduce(LongWritable key, Iterable<ImmutableBytesWritable> values, Context context) // throws IOException, InterruptedException { for (ImmutableBytesWritable v : values) { rec.setBytes(v.get(), v.getOffset(), v.getLength()); if (builder == null) { builder = new SliceBuilder(info, rec.getShard()); } //TODO: to delete this log System.out.println(rec.getShard() + " - " + rec); Slice slice = builder.append(rec); if (slice != null) { output(slice, context); } } }