You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@parquet.apache.org by GitBox <gi...@apache.org> on 2021/08/31 19:13:15 UTC

[GitHub] [parquet-mr] viirya commented on a change in pull request #923: [PARQUET-1968] FilterApi support In predicate

viirya commented on a change in pull request #923:
URL: https://github.com/apache/parquet-mr/pull/923#discussion_r699604019



##########
File path: parquet-column/src/main/java/org/apache/parquet/filter2/predicate/Operators.java
##########
@@ -247,6 +250,80 @@ public int hashCode() {
     }
   }
 
+  // base class for In and NotIn
+  public static abstract class SetColumnFilterPredicate<T extends Comparable<T>> implements FilterPredicate, Serializable {
+    private final Column<T> column;
+    private final Set<T> values;
+    private final String toString;
+
+    protected SetColumnFilterPredicate(Column<T> column, Set<T> values) {
+      this.column = Objects.requireNonNull(column, "column cannot be null");
+      this.values = Objects.requireNonNull(values, "values cannot be null");
+      checkArgument(!values.isEmpty(), "values in SetColumnFilterPredicate shouldn't be empty!");
+
+      String name = getClass().getSimpleName().toLowerCase(Locale.ENGLISH);
+      StringBuilder str = new StringBuilder();
+      int iter = 0;
+      for (T value : values) {
+        if (iter >= 100) break;
+        str.append(value).append(", ");
+        iter++;
+      }
+      String valueStr = values.size() <= 100 ? str.substring(0, str.length() - 2) : str + "...";
+      this.toString = name + "(" + column.getColumnPath().toDotString() + ", " + valueStr + ")";

Review comment:
       Is it just enough to replace `str + "..."` to `str.append("...").toString`?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@parquet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org