Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id C68D6200C6F for ; Tue, 4 Apr 2017 01:56:49 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id C51CE160BA4; Mon, 3 Apr 2017 23:56:49 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 1AC9B160B9C for ; Tue, 4 Apr 2017 01:56:48 +0200 (CEST) Received: (qmail 25584 invoked by uid 500); 3 Apr 2017 23:56:47 -0000 Mailing-List: contact dev-help@drill.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@drill.apache.org Delivered-To: mailing list dev@drill.apache.org Received: (qmail 24444 invoked by uid 99); 3 Apr 2017 23:56:47 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Apr 2017 23:56:47 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id D20DEDFEF3; Mon, 3 Apr 2017 23:56:46 +0000 (UTC) From: paul-rogers To: dev@drill.apache.org Reply-To: dev@drill.apache.org References: In-Reply-To: Subject: [GitHub] drill pull request #789: DRILL-5356: Refactor Parquet Record Reader Content-Type: text/plain Message-Id: <20170403235646.D20DEDFEF3@git1-us-west.apache.org> Date: Mon, 3 Apr 2017 23:56:46 +0000 (UTC) archived-at: Mon, 03 Apr 2017 23:56:50 -0000 Github user paul-rogers commented on a diff in the pull request: https://github.com/apache/drill/pull/789#discussion_r109513793 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/ParquetSchema.java --- @@ -0,0 +1,207 @@ +/* + * 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.drill.exec.store.parquet.columnreaders; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.drill.common.expression.SchemaPath; +import org.apache.drill.common.types.TypeProtos; +import org.apache.drill.common.types.Types; +import org.apache.drill.common.types.TypeProtos.DataMode; +import org.apache.drill.exec.exception.SchemaChangeException; +import org.apache.drill.exec.expr.TypeHelper; +import org.apache.drill.exec.physical.impl.OutputMutator; +import org.apache.drill.exec.record.MaterializedField; +import org.apache.drill.exec.server.options.OptionManager; +import org.apache.drill.exec.store.parquet.ParquetReaderUtility; +import org.apache.drill.exec.vector.NullableIntVector; +import org.apache.parquet.column.ColumnDescriptor; +import org.apache.parquet.format.SchemaElement; +import org.apache.parquet.hadoop.metadata.BlockMetaData; +import org.apache.parquet.hadoop.metadata.ColumnChunkMetaData; +import org.apache.parquet.hadoop.metadata.ParquetMetadata; + +import com.google.common.collect.Lists; + +/** + * Mapping from the schema of the Parquet file to that of the record reader + * to the schema that Drill and the Parquet reader uses. + */ + +public class ParquetSchema { + private Collection selectedCols; + // This is a parallel list to the columns list above, it is used to determine the subset of the project + // pushdown columns that do not appear in this file + private boolean[] columnsFound; + private ParquetMetadata footer; + private Map schemaElements; + private int columnsToScan; + private List columns; + private List columnMd = new ArrayList<>(); + private int bitWidthAllFixedFields; + private boolean allFieldsFixedLength = true; + private long groupRecordCount; + private int recordsPerBatch; + private int rowGroupIndex; + private final OptionManager options; + + public ParquetSchema(OptionManager options, int rowGroupIndex) { + selectedCols = null; + this.rowGroupIndex = rowGroupIndex; + this.options = options; + } + + public ParquetSchema(OptionManager options, Collection selectedCols) { + this.options = options; --- End diff -- Merged constructors as suggested and added comments. Please let me know where additional comments are needed to clarify what's happening. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---