/** * Convert a protocol buffer Mutate to a Put. * * @param proto The protocol buffer MutationProto to convert * @return A client Put. * @throws IOException */ public static Put toPut(final MutationProto proto) throws IOException { return toPut(proto, null); }
@Override public void readFields(final DataInput in) throws IOException { ClientProtos.MutationProto putProto = ClientProtos.MutationProto.parseDelimitedFrom(DataInputInputStream.from(in)); int size = in.readInt(); if(size < 0) { throw new IOException("Invalid size " + size); } Cell[] kvs = new Cell[size]; for (int i = 0; i < kvs.length; i++) { kvs[i] = KeyValue.create(in); } put = ProtobufUtil.toPut(putProto, CellUtil.createCellScanner(kvs)); } @Override
/** * Convert a MutateRequest to Mutation * * @param proto the protocol buffer Mutate to convert * @return the converted Mutation * @throws IOException */ public static Mutation toMutation(final MutationProto proto) throws IOException { MutationType type = proto.getMutateType(); if (type == MutationType.APPEND) { return toAppend(proto, null); } if (type == MutationType.DELETE) { return toDelete(proto, null); } if (type == MutationType.PUT) { return toPut(proto, null); } throw new IOException("Unknown mutation type " + type); }
/** * Convert a protocol buffer Mutate to a Put. * * @param proto The protocol buffer MutationProto to convert * @return A client Put. * @throws IOException */ public static Put toPut(final MutationProto proto) throws IOException { return toPut(proto, null); }
mutateBuilder.setDurability(MutationProto.Durability.USE_DEFAULT); Put put = ProtobufUtil.toPut(proto);
/** * Convert a MutateRequest to Mutation * * @param proto the protocol buffer Mutate to convert * @return the converted Mutation * @throws IOException */ public static Mutation toMutation(final MutationProto proto) throws IOException { MutationType type = proto.getMutateType(); if (type == MutationType.APPEND) { return toAppend(proto, null); } if (type == MutationType.DELETE) { return toDelete(proto, null); } if (type == MutationType.PUT) { return toPut(proto, null); } throw new IOException("Unknown mutation type " + type); }
/** * Convert a protocol buffer Mutate to a Put. * * @param proto The protocol buffer MutationProto to convert * @return A client Put. * @throws IOException */ public static Put toPut(final MutationProto proto) throws IOException { return toPut(proto, null); }
/** * Convert a protocol buffer Mutate to a Put. * * @param proto The protocol buffer MutationProto to convert * @return A client Put. * @throws IOException */ public static Put toPut(final MutationProto proto) throws IOException { return toPut(proto, null); }
@Override public void readFields(final DataInput in) throws IOException { ClientProtos.MutationProto putProto = ClientProtos.MutationProto.parseDelimitedFrom(DataInputInputStream.from(in)); int size = in.readInt(); if(size < 0) { throw new IOException("Invalid size " + size); } Cell[] kvs = new Cell[size]; for (int i = 0; i < kvs.length; i++) { kvs[i] = KeyValue.create(in); } put = ProtobufUtil.toPut(putProto, CellUtil.createCellScanner(kvs)); } @Override
/** * Convert a MutateRequest to Mutation * * @param proto the protocol buffer Mutate to convert * @return the converted Mutation * @throws IOException */ public static Mutation toMutation(final MutationProto proto) throws IOException { MutationType type = proto.getMutateType(); if (type == MutationType.APPEND) { return toAppend(proto, null); } if (type == MutationType.DELETE) { return toDelete(proto, null); } if (type == MutationType.PUT) { return toPut(proto, null); } throw new IOException("Unknown mutation type " + type); }
/** * Convert a MutateRequest to Mutation * * @param proto the protocol buffer Mutate to convert * @return the converted Mutation * @throws IOException */ public static Mutation toMutation(final MutationProto proto) throws IOException { MutationType type = proto.getMutateType(); if (type == MutationType.APPEND) { return toAppend(proto, null); } if (type == MutationType.DELETE) { return toDelete(proto, null); } if (type == MutationType.PUT) { return toPut(proto, null); } throw new IOException("Unknown mutation type " + type); }
@Override protected void map(BytesWritable key, BytesWritable value, Context context) throws IOException, InterruptedException { ClientProtos.MutationProto proto; // proto = ClientProtos.MutationProto.PARSER.parseFrom(new ByteArrayInputStream(value.getBytes(), 0, value.getLength())); proto = ClientProtos.MutationProto.PARSER.parseFrom(value.getBytes(), 0, value.getLength()); // System.out.println(VariantPhoenixKeyFactory.extractVariantFromVariantRowKey(key.copyBytes())); Put put = ProtobufUtil.toPut(proto); if (FillMissingFromArchiveMapper.isSampleIndexTablePut(put)) { context.getCounter(VariantsTableMapReduceHelper.COUNTER_GROUP_NAME, "sample_index_puts").increment(1); context.write(sampleIndexTable, put); } else { context.getCounter(VariantsTableMapReduceHelper.COUNTER_GROUP_NAME, "puts").increment(1); context.write(new ImmutableBytesWritable(variantsTable), put); } // Indicate that the process is still alive context.progress(); } }
Mutation mutation; if (m.getMutateType() == MutationType.PUT) { mutation = ProtobufUtil.toPut(m, cells); batchContainsPuts = true; } else {
mutateBuilder.setDurability(MutationProto.Durability.USE_DEFAULT); Put put = ProtobufUtil.toPut(proto);
rm.add(ProtobufUtil.toPut(action.getMutation(), cellScanner)); break; case DELETE:
rm.add(ProtobufUtil.toPut(action.getMutation(), cellScanner)); break; case DELETE:
break; case PUT: Put put = ProtobufUtil.toPut(mutation, cellScanner); quota.addMutation(put); if (request.hasCondition()) {