vvysotskyi commented on a change in pull request #1537: DRILL-6744: Support varchar and decimal push down URL: https://github.com/apache/drill/pull/1537#discussion_r233127110
########## File path: exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetReaderConfig.java ########## @@ -0,0 +1,175 @@ +/* + * 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; + +import com.fasterxml.jackson.annotation.JsonInclude; +import org.apache.drill.exec.ExecConstants; +import org.apache.drill.exec.server.options.OptionManager; +import org.apache.hadoop.conf.Configuration; +import org.apache.parquet.ParquetReadOptions; + +import java.util.Objects; + +import static org.apache.parquet.format.converter.ParquetMetadataConverter.NO_FILTER; + +/** + * Stores consolidated parquet reading configuration. Can obtain config values from various sources: + * Assignment priority of configuration values is the following: + * <li>parquet format config</li> + * <li>Hadoop configuration</li> + * <li>session options</li> + * + * During serialization does not deserialize the default values in keep serialized object smaller. + * Should be initialized using {@link Builder}, constructor is made public only for ser / de purposes. + */ +@JsonInclude(JsonInclude.Include.NON_DEFAULT) +public class ParquetReaderConfig { + + public static final String ENABLE_BYTES_READ_COUNTER = "parquet.benchmark.bytes.read"; + public static final String ENABLE_BYTES_TOTAL_COUNTER = "parquet.benchmark.bytes.total"; + public static final String ENABLE_TIME_READ_COUNTER = "parquet.benchmark.time.read"; + + // keep variables public for ser / de to avoid creating getters and constructor with params for all variables + // add defaults to keep deserialized object smaller + public boolean enableBytesReadCounter = false; + public boolean enableBytesTotalCounter = false; + public boolean enableTimeReadCounter = false; + public boolean autoCorrectCorruptedDates = true; + public boolean enableStringsSignedMinMax = false; + + public static ParquetReaderConfig.Builder builder() { + return new ParquetReaderConfig.Builder(); + } + + public static ParquetReaderConfig getDefaultInstance() { + return new ParquetReaderConfig(); + } + + // default constructor should be used only for ser / de and testing + public ParquetReaderConfig() { } + + public boolean autoCorrectCorruptedDates() { + return autoCorrectCorruptedDates; + } + + public boolean enableStringsSignedMinMax() { + return enableStringsSignedMinMax; + } + + public ParquetReadOptions toReadOptions() { + return ParquetReadOptions.builder() + .withMetadataFilter(NO_FILTER) Review comment: `NO_FILTER` is set in `ParquetReadOptions.Builder` by default, so it may be removed. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
