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 2022/04/19 07:11:32 UTC

[GitHub] [parquet-mr] WangGuangxin opened a new pull request, #958: PARQUET-2138: Add ShowBloomFilterCommand to parquet-cli

WangGuangxin opened a new pull request, #958:
URL: https://github.com/apache/parquet-mr/pull/958

   Add `ShowBloomFilter` command to parquet-cli. We can leverage it to check whether a block can be filtered by bloom filter.
   
   Example usage:
   ```
   parquet-cli bloom-filter -c test_column -v 1226545,3940309
   ```
   
   output
   ```
   Row group 0:
   --------------------------------------------------------------------------------
   value 1226545 maybe exists.
   value 3940309 NOT exists.
   
   Row group 1:
   --------------------------------------------------------------------------------
   value 1226545 NOT exists.
   value 3940309 NOT exists.
   ```


-- 
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


[GitHub] [parquet-mr] shangxinli commented on pull request #958: PARQUET-2138: Add ShowBloomFilterCommand to parquet-cli

Posted by GitBox <gi...@apache.org>.
shangxinli commented on PR #958:
URL: https://github.com/apache/parquet-mr/pull/958#issuecomment-1104439140

   For column encrypted files, does it work? Can you add tests for it? For how to create encrypted test file, you can refer to this file parquet-hadoop/src/test/java/org/apache/parquet/hadoop/util/ColumnEncryptorTest.java.


-- 
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


[GitHub] [parquet-mr] shangxinli commented on pull request #958: PARQUET-2138: Add ShowBloomFilterCommand to parquet-cli

Posted by GitBox <gi...@apache.org>.
shangxinli commented on PR #958:
URL: https://github.com/apache/parquet-mr/pull/958#issuecomment-1159347960

   @WangGuangxin Do you still plan to implement the decryption? I don't want to place a blocker if you don't have plan for it. 


-- 
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


[GitHub] [parquet-mr] shangxinli commented on pull request #958: PARQUET-2138: Add ShowBloomFilterCommand to parquet-cli

Posted by GitBox <gi...@apache.org>.
shangxinli commented on PR #958:
URL: https://github.com/apache/parquet-mr/pull/958#issuecomment-1172927105

   Let's merge it now and we can add column decryption later. 


-- 
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


[GitHub] [parquet-mr] shangxinli merged pull request #958: PARQUET-2138: Add ShowBloomFilterCommand to parquet-cli

Posted by GitBox <gi...@apache.org>.
shangxinli merged PR #958:
URL: https://github.com/apache/parquet-mr/pull/958


-- 
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


[GitHub] [parquet-mr] shangxinli commented on pull request #958: PARQUET-2138: Add ShowBloomFilterCommand to parquet-cli

Posted by GitBox <gi...@apache.org>.
shangxinli commented on PR #958:
URL: https://github.com/apache/parquet-mr/pull/958#issuecomment-1127058252

   Yeah, I guess you need to pass the key directly or KMS URL. 


-- 
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


[GitHub] [parquet-mr] WangGuangxin commented on pull request #958: PARQUET-2138: Add ShowBloomFilterCommand to parquet-cli

Posted by GitBox <gi...@apache.org>.
WangGuangxin commented on PR #958:
URL: https://github.com/apache/parquet-mr/pull/958#issuecomment-1109696997

   > ColumnEncryptorTest
   
   Seems if we want to read an encrypted file, we have to pass file decryption properties to reader, which doesn't support in this tool. So we need to pass decryption info by command line? 


-- 
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


[GitHub] [parquet-mr] shangxinli commented on a diff in pull request #958: PARQUET-2138: Add ShowBloomFilterCommand to parquet-cli

Posted by GitBox <gi...@apache.org>.
shangxinli commented on code in PR #958:
URL: https://github.com/apache/parquet-mr/pull/958#discussion_r854534798


##########
parquet-cli/src/main/java/org/apache/parquet/cli/commands/ShowBloomFilterCommand.java:
##########
@@ -0,0 +1,135 @@
+/*
+ * 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.parquet.cli.commands;
+
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.Parameters;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
+import java.io.IOException;
+import java.util.List;
+import java.util.Optional;
+import org.apache.commons.text.TextStringBuilder;
+import org.apache.parquet.cli.BaseCommand;
+import org.apache.parquet.cli.Util;
+import org.apache.parquet.column.values.bloomfilter.BloomFilter;
+import org.apache.parquet.hadoop.BloomFilterReader;
+import org.apache.parquet.hadoop.ParquetFileReader;
+import org.apache.parquet.hadoop.metadata.BlockMetaData;
+import org.apache.parquet.hadoop.metadata.ColumnChunkMetaData;
+import org.apache.parquet.hadoop.util.HadoopInputFile;
+import org.apache.parquet.io.InputFile;
+import org.apache.parquet.io.api.Binary;
+import org.apache.parquet.schema.MessageType;
+import org.apache.parquet.schema.PrimitiveType;
+import org.slf4j.Logger;
+
+@Parameters(commandDescription="Check bloom filters for a Parquet column")
+public class ShowBloomFilterCommand extends BaseCommand {
+
+  public ShowBloomFilterCommand(Logger console) {
+    super(console);
+  }
+
+  @Parameter(description = "<parquet path>")
+  List<String> files;
+
+  @Parameter(
+    names = { "-c", "--column" },
+    description = "Check the bloom filter indexes for the given column",
+    required = true)
+  String columnPath;
+
+  @Parameter(
+    names = { "-v", "--values" },
+    description = "Check if the given values match bloom filter",
+    required = true)
+  List<String> testValues;
+
+  @Override
+  @SuppressWarnings("unchecked")
+  public int run() throws IOException {
+    Preconditions.checkArgument(files != null && files.size() >= 1,
+      "A Parquet file is required.");
+    Preconditions.checkArgument(files.size() == 1,

Review Comment:
   Can we merge it into the above?



-- 
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