Skip to content

Commit 04f8ad4

Browse files
fix: filter limit constant (#787)
* fix: filter limit constant Should 20 KB not 20 MB * fix test
1 parent 83e0e8c commit 04f8ad4

File tree

2 files changed

+5
-5
lines changed
  • google-cloud-bigtable/src
    • main/java/com/google/cloud/bigtable/data/v2/models
    • test/java/com/google/cloud/bigtable/data/v2/models

2 files changed

+5
-5
lines changed

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/Query.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
public final class Query implements Serializable {
4444
private static final long serialVersionUID = -316972783499434755L;
4545

46-
// bigtable can server the largest filter size of 20MB.
47-
private static final int MAX_FILTER_SIZE = 20 * 1024 * 1024;
46+
// bigtable can server the largest filter size of 20KB.
47+
private static final int MAX_FILTER_SIZE = 20 * 1024;
4848

4949
private final String tableId;
5050
private transient ReadRowsRequest.Builder builder = ReadRowsRequest.newBuilder();
@@ -170,7 +170,7 @@ public Query filter(Filters.Filter filter) {
170170

171171
RowFilter rowFilter = filter.toProto();
172172
Preconditions.checkArgument(
173-
rowFilter.getSerializedSize() < MAX_FILTER_SIZE, "filter size can't be more than 20MB");
173+
rowFilter.getSerializedSize() < MAX_FILTER_SIZE, "filter size can't be more than 20KB");
174174

175175
builder.setFilter(rowFilter);
176176
return this;

google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/QueryTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,15 @@ public void filterTestWithExceptions() {
123123
assertThat(actualException).isInstanceOf(NullPointerException.class);
124124

125125
actualException = null;
126-
int maxFilterSize = 20 * 1024 * 1024;
126+
int maxFilterSize = 20 * 1024;
127127
ByteString largeValue = ByteString.copyFrom(new byte[maxFilterSize + 1]);
128128

129129
try {
130130
Query.create(TABLE_ID).filter(FILTERS.value().exactMatch(largeValue));
131131
} catch (Exception ex) {
132132
actualException = ex;
133133
}
134-
assertThat(actualException).hasMessageThat().contains("filter size can't be more than 20MB");
134+
assertThat(actualException).hasMessageThat().contains("filter size can't be more than 20KB");
135135
}
136136

137137
@Test

0 commit comments

Comments
 (0)