[
https://issues.apache.org/jira/browse/PARQUET-2195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17615893#comment-17615893
]
ASF GitHub Bot commented on PARQUET-2195:
-----------------------------------------
wgtmac commented on code in PR #998:
URL: https://github.com/apache/parquet-mr/pull/998#discussion_r992446760
##########
parquet-cli/src/main/java/org/apache/parquet/cli/commands/ScanCommand.java:
##########
@@ -0,0 +1,94 @@
+/*
+ * 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 com.google.common.io.Closeables;
+import org.apache.avro.Schema;
+import org.apache.parquet.cli.BaseCommand;
+import org.apache.parquet.cli.util.Expressions;
+import org.slf4j.Logger;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.util.List;
+
+@Parameters(commandDescription = "Scan all records from a file")
+public class ScanCommand extends BaseCommand {
+
+ @Parameter(description = "<file>")
+ List<String> sourceFiles;
+
+ @Parameter(
+ names = {"-c", "--column", "--columns"},
+ description = "List of columns")
+ List<String> columns;
+
+ public ScanCommand(Logger console) {
+ super(console);
+ }
+
+ @Override
+ public int run() throws IOException {
+ Preconditions.checkArgument(
+ sourceFiles != null && !sourceFiles.isEmpty(),
+ "Missing file name");
+ Preconditions.checkArgument(sourceFiles.size() == 1,
+ "Only one file can be given");
Review Comment:
Fixed
> Add scan command to parquet-cli
> -------------------------------
>
> Key: PARQUET-2195
> URL: https://issues.apache.org/jira/browse/PARQUET-2195
> Project: Parquet
> Issue Type: Improvement
> Components: parquet-cli
> Reporter: Gang Wu
> Priority: Major
>
> parquet-cli has *cat* and *head* commands to print the records but it does
> not have the capability to *scan* (w/o printing) all records to check if the
> file is corrupted.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)