From 953b52627987360c77cd87013e33b74df9d2b72c Mon Sep 17 00:00:00 2001 From: Igor Bernstein Date: Tue, 27 Apr 2021 15:31:46 -0400 Subject: [PATCH 1/2] fix: filter limit constant Should 20 KB not 20 MB --- .../com/google/cloud/bigtable/data/v2/models/Query.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/Query.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/Query.java index 765fa01205..986a0ca1a5 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/Query.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/Query.java @@ -43,8 +43,8 @@ public final class Query implements Serializable { private static final long serialVersionUID = -316972783499434755L; - // bigtable can server the largest filter size of 20MB. - private static final int MAX_FILTER_SIZE = 20 * 1024 * 1024; + // bigtable can server the largest filter size of 20KB. + private static final int MAX_FILTER_SIZE = 20 * 1024; private final String tableId; private transient ReadRowsRequest.Builder builder = ReadRowsRequest.newBuilder(); @@ -170,7 +170,7 @@ public Query filter(Filters.Filter filter) { RowFilter rowFilter = filter.toProto(); Preconditions.checkArgument( - rowFilter.getSerializedSize() < MAX_FILTER_SIZE, "filter size can't be more than 20MB"); + rowFilter.getSerializedSize() < MAX_FILTER_SIZE, "filter size can't be more than 20KB"); builder.setFilter(rowFilter); return this; From 15b5060400b82afc58077cae08d15e0f5b452a23 Mon Sep 17 00:00:00 2001 From: Igor Bernstein Date: Wed, 5 May 2021 14:28:42 -0400 Subject: [PATCH 2/2] fix test --- .../com/google/cloud/bigtable/data/v2/models/QueryTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/QueryTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/QueryTest.java index bf6abcd168..a6204890b4 100644 --- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/QueryTest.java +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/QueryTest.java @@ -123,7 +123,7 @@ public void filterTestWithExceptions() { assertThat(actualException).isInstanceOf(NullPointerException.class); actualException = null; - int maxFilterSize = 20 * 1024 * 1024; + int maxFilterSize = 20 * 1024; ByteString largeValue = ByteString.copyFrom(new byte[maxFilterSize + 1]); try { @@ -131,7 +131,7 @@ public void filterTestWithExceptions() { } catch (Exception ex) { actualException = ex; } - assertThat(actualException).hasMessageThat().contains("filter size can't be more than 20MB"); + assertThat(actualException).hasMessageThat().contains("filter size can't be more than 20KB"); } @Test