[
https://issues.apache.org/jira/browse/PARQUET-2318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17738160#comment-17738160
]
ASF GitHub Bot commented on PARQUET-2318:
-----------------------------------------
shangxinli commented on code in PR #1117:
URL: https://github.com/apache/parquet-mr/pull/1117#discussion_r1245353146
##########
parquet-cli/src/main/java/org/apache/parquet/cli/rawpages/RawPagesReader.java:
##########
@@ -0,0 +1,92 @@
+/*
+ * 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.rawpages;
+
+import static org.apache.parquet.hadoop.ParquetFileWriter.MAGIC;
+
+import java.io.IOException;
+
+import org.apache.parquet.cli.util.RawUtils;
+import org.apache.parquet.format.CliUtils;
+import org.apache.parquet.format.ColumnChunk;
+import org.apache.parquet.format.ColumnMetaData;
+import org.apache.parquet.format.FileMetaData;
+import org.apache.parquet.format.PageHeader;
+import org.apache.parquet.format.RowGroup;
+import org.apache.parquet.format.Util;
+import org.apache.parquet.io.InputFile;
+import org.apache.parquet.io.SeekableInputStream;
+import org.slf4j.Logger;
+
+public class RawPagesReader implements AutoCloseable {
+
+ private final SeekableInputStream input;
+ private final FileMetaData footer;
+
+ public RawPagesReader(InputFile file) throws IOException {
+ long fileLen = file.getLength();
+
+ if (fileLen < MAGIC.length + 4 + MAGIC.length) {
+ throw new RuntimeException("Not a Parquet file (length is too low: " +
fileLen + ")");
+ }
+
+ input = file.newStream();
+ footer = RawUtils.readFooter(input, fileLen);
+ }
+
+ public void listPages(Logger console) throws IOException {
+ for (int i = 0, n = footer.getRow_groupsSize(); i < n; ++i) {
Review Comment:
Got it.
> Implement a tool to list page headers
> -------------------------------------
>
> Key: PARQUET-2318
> URL: https://issues.apache.org/jira/browse/PARQUET-2318
> Project: Parquet
> Issue Type: New Feature
> Components: parquet-cli
> Reporter: Gabor Szadovszky
> Assignee: Gabor Szadovszky
> Priority: Major
>
> Needs a tool which lists the page headers in a Parquet file for debugging
> purposes.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)