/** * * * <pre> * The filter to be applied to the contents of the specified row. Depending * on whether or not any results are yielded, either `true_mutations` or * `false_mutations` will be executed. If unset, checks that the row contains * any values at all. * </pre> * * <code>.google.bigtable.v2.RowFilter predicate_filter = 6;</code> */ public com.google.bigtable.v2.RowFilterOrBuilder getPredicateFilterOrBuilder() { return getPredicateFilter(); }
@java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!getTableNameBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, tableName_); } if (!rowKey_.isEmpty()) { output.writeBytes(2, rowKey_); } for (int i = 0; i < trueMutations_.size(); i++) { output.writeMessage(4, trueMutations_.get(i)); } for (int i = 0; i < falseMutations_.size(); i++) { output.writeMessage(5, falseMutations_.get(i)); } if (predicateFilter_ != null) { output.writeMessage(6, getPredicateFilter()); } if (!getAppProfileIdBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 7, appProfileId_); } unknownFields.writeTo(output); }
@java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (!getTableNameBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, tableName_); } if (!rowKey_.isEmpty()) { size += com.google.protobuf.CodedOutputStream.computeBytesSize(2, rowKey_); } for (int i = 0; i < trueMutations_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, trueMutations_.get(i)); } for (int i = 0; i < falseMutations_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, falseMutations_.get(i)); } if (predicateFilter_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getPredicateFilter()); } if (!getAppProfileIdBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(7, appProfileId_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.bigtable.v2.CheckAndMutateRowRequest)) { return super.equals(obj); } com.google.bigtable.v2.CheckAndMutateRowRequest other = (com.google.bigtable.v2.CheckAndMutateRowRequest) obj; boolean result = true; result = result && getTableName().equals(other.getTableName()); result = result && getAppProfileId().equals(other.getAppProfileId()); result = result && getRowKey().equals(other.getRowKey()); result = result && (hasPredicateFilter() == other.hasPredicateFilter()); if (hasPredicateFilter()) { result = result && getPredicateFilter().equals(other.getPredicateFilter()); } result = result && getTrueMutationsList().equals(other.getTrueMutationsList()); result = result && getFalseMutationsList().equals(other.getFalseMutationsList()); result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + TABLE_NAME_FIELD_NUMBER; hash = (53 * hash) + getTableName().hashCode(); hash = (37 * hash) + APP_PROFILE_ID_FIELD_NUMBER; hash = (53 * hash) + getAppProfileId().hashCode(); hash = (37 * hash) + ROW_KEY_FIELD_NUMBER; hash = (53 * hash) + getRowKey().hashCode(); if (hasPredicateFilter()) { hash = (37 * hash) + PREDICATE_FILTER_FIELD_NUMBER; hash = (53 * hash) + getPredicateFilter().hashCode(); } if (getTrueMutationsCount() > 0) { hash = (37 * hash) + TRUE_MUTATIONS_FIELD_NUMBER; hash = (53 * hash) + getTrueMutationsList().hashCode(); } if (getFalseMutationsCount() > 0) { hash = (37 * hash) + FALSE_MUTATIONS_FIELD_NUMBER; hash = (53 * hash) + getFalseMutationsList().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
mergePredicateFilter(other.getPredicateFilter());
@Test public void conditionTest() { ConditionalRowMutation mutation = ConditionalRowMutation.create(TABLE_ID, TEST_KEY) .condition(Filters.FILTERS.key().regex("a.*")) .then(Mutation.create().deleteRow()); CheckAndMutateRowRequest actualProto = mutation.toProto(REQUEST_CONTEXT); assertThat(actualProto.getPredicateFilter()) .isEqualTo( RowFilter.newBuilder().setRowKeyRegexFilter(ByteString.copyFromUtf8("a.*")).build()); }
@Test @SuppressWarnings("all") public void checkAndMutateRowTest() { boolean predicateMatched = true; CheckAndMutateRowResponse expectedResponse = CheckAndMutateRowResponse.newBuilder().setPredicateMatched(predicateMatched).build(); mockBigtable.addResponse(expectedResponse); TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); ByteString rowKey = ByteString.copyFromUtf8("122"); RowFilter predicateFilter = RowFilter.newBuilder().build(); List<Mutation> trueMutations = new ArrayList<>(); List<Mutation> falseMutations = new ArrayList<>(); CheckAndMutateRowResponse actualResponse = client.checkAndMutateRow(tableName, rowKey, predicateFilter, trueMutations, falseMutations); Assert.assertEquals(expectedResponse, actualResponse); List<GeneratedMessageV3> actualRequests = mockBigtable.getRequests(); Assert.assertEquals(1, actualRequests.size()); CheckAndMutateRowRequest actualRequest = (CheckAndMutateRowRequest) actualRequests.get(0); Assert.assertEquals(tableName, TableName.parse(actualRequest.getTableName())); Assert.assertEquals(rowKey, actualRequest.getRowKey()); Assert.assertEquals(predicateFilter, actualRequest.getPredicateFilter()); Assert.assertEquals(trueMutations, actualRequest.getTrueMutationsList()); Assert.assertEquals(falseMutations, actualRequest.getFalseMutationsList()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
/** * <pre> * The filter to be applied to the contents of the specified row. Depending * on whether or not any results are yielded, either `true_mutations` or * `false_mutations` will be executed. If unset, checks that the row contains * any values at all. * </pre> * * <code>.google.bigtable.v2.RowFilter predicate_filter = 6;</code> */ public com.google.bigtable.v2.RowFilterOrBuilder getPredicateFilterOrBuilder() { return getPredicateFilter(); }
/** * * * <pre> * The filter to be applied to the contents of the specified row. Depending * on whether or not any results are yielded, either `true_mutations` or * `false_mutations` will be executed. If unset, checks that the row contains * any values at all. * </pre> * * <code>.google.bigtable.v2.RowFilter predicate_filter = 6;</code> */ public com.google.bigtable.v2.RowFilterOrBuilder getPredicateFilterOrBuilder() { return getPredicateFilter(); }
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!getTableNameBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, tableName_); } if (!rowKey_.isEmpty()) { output.writeBytes(2, rowKey_); } for (int i = 0; i < trueMutations_.size(); i++) { output.writeMessage(4, trueMutations_.get(i)); } for (int i = 0; i < falseMutations_.size(); i++) { output.writeMessage(5, falseMutations_.get(i)); } if (predicateFilter_ != null) { output.writeMessage(6, getPredicateFilter()); } }
@java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!getTableNameBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, tableName_); } if (!rowKey_.isEmpty()) { output.writeBytes(2, rowKey_); } for (int i = 0; i < trueMutations_.size(); i++) { output.writeMessage(4, trueMutations_.get(i)); } for (int i = 0; i < falseMutations_.size(); i++) { output.writeMessage(5, falseMutations_.get(i)); } if (predicateFilter_ != null) { output.writeMessage(6, getPredicateFilter()); } if (!getAppProfileIdBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 7, appProfileId_); } unknownFields.writeTo(output); }
public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (!getTableNameBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, tableName_); } if (!rowKey_.isEmpty()) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, rowKey_); } for (int i = 0; i < trueMutations_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(4, trueMutations_.get(i)); } for (int i = 0; i < falseMutations_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(5, falseMutations_.get(i)); } if (predicateFilter_ != null) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(6, getPredicateFilter()); } memoizedSize = size; return size; }
@java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (!getTableNameBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, tableName_); } if (!rowKey_.isEmpty()) { size += com.google.protobuf.CodedOutputStream.computeBytesSize(2, rowKey_); } for (int i = 0; i < trueMutations_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, trueMutations_.get(i)); } for (int i = 0; i < falseMutations_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, falseMutations_.get(i)); } if (predicateFilter_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getPredicateFilter()); } if (!getAppProfileIdBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(7, appProfileId_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.bigtable.v2.CheckAndMutateRowRequest)) { return super.equals(obj); } com.google.bigtable.v2.CheckAndMutateRowRequest other = (com.google.bigtable.v2.CheckAndMutateRowRequest) obj; boolean result = true; result = result && getTableName().equals(other.getTableName()); result = result && getAppProfileId().equals(other.getAppProfileId()); result = result && getRowKey().equals(other.getRowKey()); result = result && (hasPredicateFilter() == other.hasPredicateFilter()); if (hasPredicateFilter()) { result = result && getPredicateFilter().equals(other.getPredicateFilter()); } result = result && getTrueMutationsList().equals(other.getTrueMutationsList()); result = result && getFalseMutationsList().equals(other.getFalseMutationsList()); result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + TABLE_NAME_FIELD_NUMBER; hash = (53 * hash) + getTableName().hashCode(); hash = (37 * hash) + ROW_KEY_FIELD_NUMBER; hash = (53 * hash) + getRowKey().hashCode(); if (hasPredicateFilter()) { hash = (37 * hash) + PREDICATE_FILTER_FIELD_NUMBER; hash = (53 * hash) + getPredicateFilter().hashCode(); } if (getTrueMutationsCount() > 0) { hash = (37 * hash) + TRUE_MUTATIONS_FIELD_NUMBER; hash = (53 * hash) + getTrueMutationsList().hashCode(); } if (getFalseMutationsCount() > 0) { hash = (37 * hash) + FALSE_MUTATIONS_FIELD_NUMBER; hash = (53 * hash) + getFalseMutationsList().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.bigtable.v2.CheckAndMutateRowRequest)) { return super.equals(obj); } com.google.bigtable.v2.CheckAndMutateRowRequest other = (com.google.bigtable.v2.CheckAndMutateRowRequest) obj; boolean result = true; result = result && getTableName() .equals(other.getTableName()); result = result && getRowKey() .equals(other.getRowKey()); result = result && (hasPredicateFilter() == other.hasPredicateFilter()); if (hasPredicateFilter()) { result = result && getPredicateFilter() .equals(other.getPredicateFilter()); } result = result && getTrueMutationsList() .equals(other.getTrueMutationsList()); result = result && getFalseMutationsList() .equals(other.getFalseMutationsList()); return result; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + TABLE_NAME_FIELD_NUMBER; hash = (53 * hash) + getTableName().hashCode(); hash = (37 * hash) + APP_PROFILE_ID_FIELD_NUMBER; hash = (53 * hash) + getAppProfileId().hashCode(); hash = (37 * hash) + ROW_KEY_FIELD_NUMBER; hash = (53 * hash) + getRowKey().hashCode(); if (hasPredicateFilter()) { hash = (37 * hash) + PREDICATE_FILTER_FIELD_NUMBER; hash = (53 * hash) + getPredicateFilter().hashCode(); } if (getTrueMutationsCount() > 0) { hash = (37 * hash) + TRUE_MUTATIONS_FIELD_NUMBER; hash = (53 * hash) + getTrueMutationsList().hashCode(); } if (getFalseMutationsCount() > 0) { hash = (37 * hash) + FALSE_MUTATIONS_FIELD_NUMBER; hash = (53 * hash) + getFalseMutationsList().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
mergePredicateFilter(other.getPredicateFilter());
mergePredicateFilter(other.getPredicateFilter());