Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: filter limit constant #787

Merged
merged 2 commits into from May 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down
Expand Up @@ -123,15 +123,15 @@ 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 {
Query.create(TABLE_ID).filter(FILTERS.value().exactMatch(largeValue));
} 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
Expand Down