This is an automated email from the ASF dual-hosted git repository. gjacoby pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/master by this push: new e383eef PHOENIX-5264: Implement toString() of EncodedQualifiersColumnProjectionFilter with some useful output. e383eef is described below commit e383eefe199ab1b1df43a5e7342dbd236ea3a231 Author: Priyank Porwal <ppor...@salesforce.com> AuthorDate: Tue Apr 30 11:01:56 2019 -0700 PHOENIX-5264: Implement toString() of EncodedQualifiersColumnProjectionFilter with some useful output. --- .../EncodedQualifiersColumnProjectionFilter.java | 10 +++- ...ncodedQualifiersColumnProjectionFilterTest.java | 61 ++++++++++++++++++++++ 2 files changed, 70 insertions(+), 1 deletion(-) diff --git a/phoenix-core/src/main/java/org/apache/phoenix/filter/EncodedQualifiersColumnProjectionFilter.java b/phoenix-core/src/main/java/org/apache/phoenix/filter/EncodedQualifiersColumnProjectionFilter.java index cfacb4f..92ac128 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/filter/EncodedQualifiersColumnProjectionFilter.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/filter/EncodedQualifiersColumnProjectionFilter.java @@ -137,7 +137,15 @@ public class EncodedQualifiersColumnProjectionFilter extends FilterBase implemen @Override public String toString() { - return ""; + StringBuilder sb = new StringBuilder(100); + sb.append(String.format("EmptyCFName: %s, ", Bytes.toStringBinary(this.emptyCFName))); + sb.append(String.format("EncodingScheme: %s, ", this.encodingScheme)); + sb.append(String.format("TrackedColumns: %s, ", this.trackedColumns)); + sb.append("ConditionOnlyCfs: "); + for (byte[] conditionOnlyCf : this.conditionOnlyCfs) { + sb.append(String.format("%s, ", Bytes.toStringBinary(conditionOnlyCf))); + } + return sb.toString(); } @Override diff --git a/phoenix-core/src/test/java/org/apache/phoenix/filter/EncodedQualifiersColumnProjectionFilterTest.java b/phoenix-core/src/test/java/org/apache/phoenix/filter/EncodedQualifiersColumnProjectionFilterTest.java new file mode 100644 index 0000000..d4f1372 --- /dev/null +++ b/phoenix-core/src/test/java/org/apache/phoenix/filter/EncodedQualifiersColumnProjectionFilterTest.java @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.phoenix.filter; + +import java.util.BitSet; +import java.util.HashSet; +import org.apache.phoenix.schema.PTable.QualifierEncodingScheme; +import junit.framework.TestCase; + +public class EncodedQualifiersColumnProjectionFilterTest extends TestCase { + + private final String someEmptyCFName = "cfName1"; + private final String someConditionalCFName1 = "conditionalCfName1"; + private final String someConditionalCFName2 = "conditionalCfName2"; + private final QualifierEncodingScheme someQualifiedEncodingScheme = QualifierEncodingScheme.ONE_BYTE_QUALIFIERS; + private final BitSet someBitSet; + private EncodedQualifiersColumnProjectionFilter filter; + + public EncodedQualifiersColumnProjectionFilterTest() { + HashSet<byte[]> conditionalCFNames = new HashSet<byte[]>(2); + conditionalCFNames.add(someConditionalCFName1.getBytes()); + conditionalCFNames.add(someConditionalCFName2.getBytes()); + + this.someBitSet = new BitSet(); + this.someBitSet.xor(new BitSet(0)); // All 1s + + this.filter = new EncodedQualifiersColumnProjectionFilter( + this.someEmptyCFName.getBytes(), + someBitSet, + conditionalCFNames, + this.someQualifiedEncodingScheme); + } + + public void testToString() { + String outputString = this.filter.toString(); + + assertTrue(outputString.contains("EmptyCFName")); + assertTrue(outputString.contains("EncodingScheme")); + assertTrue(outputString.contains("TrackedColumns")); + assertTrue(outputString.contains("ConditionOnlyCfs")); + assertTrue(outputString.contains(this.someEmptyCFName)); + assertTrue(outputString.contains(this.someConditionalCFName1)); + assertTrue(outputString.contains(this.someConditionalCFName2)); + assertTrue(outputString.contains(this.someBitSet.toString())); + } +}