@Override public Mutation setCell( @Nonnull String familyName, @Nonnull ByteString qualifier, long timestamp, @Nonnull ByteString value) { Validations.validateFamily(familyName); Preconditions.checkNotNull(qualifier, "qualifier can't be null."); Preconditions.checkNotNull(value, "value can't be null."); if (!allowServersideTimestamp) { Preconditions.checkArgument( timestamp != SERVER_SIDE_TIMESTAMP, "Serverside timestamps are not supported"); } addMutation( com.google.bigtable.v2.Mutation.newBuilder() .setSetCell( SetCell.newBuilder() .setFamilyName(familyName) .setColumnQualifier(qualifier) .setTimestampMicros(timestamp) .setValue(value) .build()) .build()); return this; }
setCellBuilder.setTimestampMicros(System.currentTimeMillis() * 1000);
public Builder mergeFrom(com.google.bigtable.v2.Mutation.SetCell other) { if (other == com.google.bigtable.v2.Mutation.SetCell.getDefaultInstance()) return this; if (!other.getFamilyName().isEmpty()) { familyName_ = other.familyName_; onChanged(); } if (other.getColumnQualifier() != com.google.protobuf.ByteString.EMPTY) { setColumnQualifier(other.getColumnQualifier()); } if (other.getTimestampMicros() != 0L) { setTimestampMicros(other.getTimestampMicros()); } if (other.getValue() != com.google.protobuf.ByteString.EMPTY) { setValue(other.getValue()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@Override public Mutation setCell( @Nonnull String familyName, @Nonnull ByteString qualifier, long timestamp, @Nonnull ByteString value) { Validations.validateFamily(familyName); Preconditions.checkNotNull(qualifier, "qualifier can't be null."); Preconditions.checkNotNull(value, "value can't be null."); if (!allowServersideTimestamp) { Preconditions.checkArgument( timestamp != SERVER_SIDE_TIMESTAMP, "Serverside timestamps are not supported"); } addMutation( com.google.bigtable.v2.Mutation.newBuilder() .setSetCell( SetCell.newBuilder() .setFamilyName(familyName) .setColumnQualifier(qualifier) .setTimestampMicros(timestamp) .setValue(value) .build()) .build()); return this; }
@Override public KV<ByteString, Iterable<Mutation>> apply(BigtableRow row) { ByteString key = toByteString(row.getKey()); // BulkMutation doesn't split rows. Currently, if a single row contains more than 100,000 // mutations, the service will fail the request. ImmutableList.Builder<Mutation> mutations = ImmutableList.builder(); for (BigtableCell cell : row.getCells()) { SetCell setCell = SetCell.newBuilder() .setFamilyName(cell.getFamily().toString()) .setColumnQualifier(toByteString(cell.getQualifier())) .setTimestampMicros(cell.getTimestamp()) .setValue(toByteString(cell.getValue())) .build(); mutations.add(Mutation.newBuilder().setSetCell(setCell).build()); } return KV.of(key, mutations.build()); } }
public Builder mergeFrom(com.google.bigtable.v2.Mutation.SetCell other) { if (other == com.google.bigtable.v2.Mutation.SetCell.getDefaultInstance()) return this; if (!other.getFamilyName().isEmpty()) { familyName_ = other.familyName_; onChanged(); } if (other.getColumnQualifier() != com.google.protobuf.ByteString.EMPTY) { setColumnQualifier(other.getColumnQualifier()); } if (other.getTimestampMicros() != 0L) { setTimestampMicros(other.getTimestampMicros()); } if (other.getValue() != com.google.protobuf.ByteString.EMPTY) { setValue(other.getValue()); } onChanged(); return this; }
public Builder mergeFrom(com.google.bigtable.v2.Mutation.SetCell other) { if (other == com.google.bigtable.v2.Mutation.SetCell.getDefaultInstance()) return this; if (!other.getFamilyName().isEmpty()) { familyName_ = other.familyName_; onChanged(); } if (other.getColumnQualifier() != com.google.protobuf.ByteString.EMPTY) { setColumnQualifier(other.getColumnQualifier()); } if (other.getTimestampMicros() != 0L) { setTimestampMicros(other.getTimestampMicros()); } if (other.getValue() != com.google.protobuf.ByteString.EMPTY) { setValue(other.getValue()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
private static MutateRowsRequest createRequest(int count) { MutateRowsRequest.Builder request = MutateRowsRequest.newBuilder() .setTableName(NameUtil.formatTableName(PROJECT_ID, INSTANCE_ID, TABLE_ID)); for (int i = 0; i < count; i++) { Builder entry = Entry.newBuilder() .addMutations( Mutation.newBuilder() .setSetCell( SetCell.newBuilder() .setFamilyName("family") .setColumnQualifier(ByteString.copyFromUtf8("col" + i)) .setTimestampMicros(1000) .setValue(ByteString.copyFromUtf8("value" + i)))); request.addEntries(entry); } return request.build(); } }